-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔷 [Epic] Persistent siloed browser localstorage & session storage #27
Comments
Andy Haynes
Michael Peter
Andy Haynes
Michael Peter
Andy Haynes
Michael Peter
Andy Haynes
Michael Peter
Andy Haynes
Michael Peter
Andy Haynes
Michael Peter
Andy Haynes
Michael Peter
|
Originally this was intended to replicate BOS VM functionality where every instance of the same component shares local storage. This is likely not ideal for real world usage. Instead, the scope should be more granular, perhaps container ID + component key |
since this is going to result in an async API anyways, it's worth considering backing this by IndexedDB instead of localstorage |
not in scope but may be requested in future: https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event |
Goalsupports standard localstorage use cases Considerationsdata needs to be protected from arbitrary access by other components on the page Implementation notes
|
Leaving a few thoughts and open questions on the Storage implementation. Storage will be referred as a RocStorage, but in general it will mimic the browser LocalStorage. 1. API assumptions:In order to send the message from the component to the RocStorage, we need to provide a way to access its api from the user component. const rocStorage = /* implementation of the storage */ This way we can inject the export default function () {
console.log(rocStorage) // contains the rocStorage from the SandboxedIframe
return (
<div>
<h1>Storage test</h1>
</div>
);
}
2. Transport assumptions:The component can not directly read/write to the browser Local Storage, that's why the transport of the api call should be done via the
3. Component folders:
|
I think we should avoid global scope injection wherever possible - it's abused enough as is 😅. Maybe an RoC plugin based approach would work like we do with
This is what the plugin architecture would get us for free 🙂 Check out the Wallet Selector RoC plugin here: https://github.com/near/bos-web-engine/blob/main/packages/wallet-selector-plugin/src/index.ts And how the outer application handles plugin methods: https://github.com/near/bos-web-engine/blob/main/packages/application/src/handlers.ts#L14 |
Summary from our R&D discussion:
|
Components should be able to store and retrieve data from browser storage across sessions
The text was updated successfully, but these errors were encountered: