Skip to content
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

Flash of contents #16

Open
faassen opened this issue Jun 28, 2022 · 0 comments
Open

Flash of contents #16

faassen opened this issue Jun 28, 2022 · 0 comments

Comments

@faassen
Copy link
Collaborator

faassen commented Jun 28, 2022

When a webxdc instance is opened on a port, there is sometimes a flash of contents. This happens to clear the local state (localstorage, etc) of the previous instance so we start with a fresh slate, and then the application is reloaded. After this, the setUpdateListener is registered for serial 0 and the state is loaded anew.

How to avoid this flash of content? The trouble is that we don't know whether clear is going to come in. A normal reload shouldn't wipe local state, only the initial opening does.

I considered turning off the UI (by setting document.style.display = 'none') in the window.load event but:

  • this may already be too late to prevent a flash of content

  • we want to reenable the display sometime, and when to do that? We can't wait for an update or clear, as it may not arrive.

I considered loading a custom index.html initially when you open a tab, and then clearing contents if a clear event comes from the server, and buffering any other updates somehow, and then reloading to the real index.html and piping in all the buffered updates. But this seems very tricky to get right.

Perhaps the simplest approach would be some kind of setTimeout, but again the reload makes things difficult...

@Septias Septias changed the title flash of contents Flash of contents Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant