Local Storage Limitations
LWS creates synthetic storage for each sandbox. The synthetic storage prevents code in one sandbox from retrieving data that belongs to another namespace or that was set in the global scope outside LWS sandboxes.
sessionStorage are partitioned by keys. When LWS is enabled, key values that are set outside the namespace aren’t accessible because LWS creates key names that are unique to the namespace.
To share data stored in local storage with code running in a different namespace, create a function and export it from one namespace to allow the other namespace to import and call the function.
Lightning Locker and LWS use different mechanisms for protecting local storage. Data that’s saved to local storage while Locker is enabled isn’t accessible when LWS is enabled, and vice versa. If the LWS setting changes after data is saved in local storage, the data isn’t accessible even when set by components in the same namespace. Rewrite the
sessionStorage data after enabling or disabling LWS.