I have implemented something that possibly could work. {code} /** * Creates new instance of client with empty cache . * Can change context of the app (onLogout etc.) */ client. fushCacheStorage = async ()=>{ await client. destroyClient() window.localstorage.removeitem(config.storageKey); // Requires us to use custom cache key in cache persist window.localstorage.removeitem(config.cacheKey); client = await createClient(config) return client; } {code}
Let's do something like this and call it a day.
Edit:
After testing this I see that this can be problematic in terms of elements we do not control: , client instance could be spread around different user components. There are two ways to do that - we can replace client internally with reference to the new one. The entire thing is quite risky in terms of the processing so we will need to make sure that previous client is also destroyed properly before we do execute another command.
Using metalanguage:
1. Destroy client to stop processing everything 2. Clear cache 3. Clear offline storage (probably riskiest stuff ever) 4. initialize new client 5. Swap client (this should be probably responsiblity of the user and it will work with showcase as we have single instance that is being hold in service but for react previous versions will be burried deep inside components - by flushing users also need to reinitialize entire app. |
|