Repository navigation
fix(layout): only reload after a real background period - #301
Open
MasterK0927 wants to merge 1 commit into
Open
MasterK0927 wants to merge 1 commit into
MasterK0927 wants to merge 1 commit into
Conversation
lastBackgroundTime starts at 0, so the first visibilitychange to visible without an earlier hidden event looked like a long Doze and reloaded the page. On desktop this happens when the window opens on another Space or behind other windows, and the reload ends any call in progress.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
In
ui/src/routes/+layout.svelte, the Doze check works like this:lastBackgroundTimeis only set when the page goeshidden. If the page becomesvisiblewithout ahiddenevent first,lastBackgroundTimeis still0. SobackgroundDurationMsisDate.now() - 0, about 56 years, the check passes, and the app callswindow.location.reload()with no real background period at all.On desktop this happens whenever the window first opens on another Space or behind other windows: the first time you bring it forward, the app reloads. Anything in memory is lost, including a call in progress. On
feat/av-conferences-newit ended a call the moment the user pressed Accept.Fix
Reload only when there was a real hidden period:
The Android Doze case doesn't change: going to the background always fires
hiddenfirst, which setslastBackgroundTime.Testing