lukashornych / evitalab

Official web-based GUI client for evitaDB e-commerce database. It is built to help developers who use evitaDB with exploring and debugging their domain structure and data. Besides standard query executing, it also supports multiple no-code tools to quickly navigate through domain structure, docs and data without needing to write any queries.
https://github.com/lukashornych/evitalab
Apache License 2.0
7 stars 1 forks source link

Store and restore opened tabs between browser sessions #104

Closed lukashornych closed 5 months ago

lukashornych commented 5 months ago

We want to restore lastly opened tabs. We already have support for tab serialization thanks to the https://github.com/lukashornych/evitalab/issues/96 so we can use that.

Handling storing/restoring + handling multiple tabs, shared tabs, demo requests

Tabs will be stored in local storage. The actual storing of current tabs will happen on onunload/onbeforeunload JS event, until that, the data will be only in memory of LabEditor component. The subsequent new evitaLab instance start, the editor will pick up lastly stored tabs (if any), remove them from storage and loads them to memory. And so on.

If a new evitaLab session will be opened in parallel to already existing one (in different browser tab), there will be no tabs to restore in storage (which is correct, we don't want to duplicate stale version of tabs that were already picked up), empty session will be created. Each session closing will store its tabs in storage. If multiple parallel sessions will be closed, the last one will be restored on next evitaLab session.

If evitaLab is created through shared tab or demo request, no session will be restored and the editor will not store the actual session on closing. It will be functioning in "playground" mode or something. This is to prevent unwanted overriding of previously crafted session when someone sends a link with shared tab to the user or the user will be reading documentation and opens example in evitaLab. We don't want to restore last session in this cases, because the user may accidently lose the previous session if closed parallel sessions in wrong order in hope that the shared tab or demo request is not actual session.