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.
Description
Fixes #19443 and #19471.
PR #9046 added the concept of preview sessions for v8.10. This enabled a way to track how many browser tabs/windows were actively viewing in preview mode. When a browser tab/window was closed, the number would decrease, when zero, the preview mode would exit.
Since implementing this feature for v14+ and investigating subsequent bug reports, we found that the original implementation had a design flaw, in that the initial number of sessions created was doubled due to the
"UmbPreviewSessionAmount"localStorage value being set in both the backoffice preview app ("preview.controller.js") and the frontend website's preview toolbar ("websitepreview.js").(Side-note: The backoffice preview app would attempt to hide the frontend preview toolbar,
#umbracoPreviewBadge, but this was after the scripts had already executed).This meant that when a browser tab/window was closed, the session number would decrease, but it wouldn't hit zero (and wouldn't exit the preview mode). Browser reloads would decrement the session amount, then increment again on load, (e.g. if the amount were zero, then the preview mode would be exited, as described in #19443).
Upon review of how to resolve this for v16+, we came to the conclusion that exiting preview mode should be a deliberate action by the user. To that, we have removed the concept of preview sessions from the preview-app.
It is worth noting that the Preview Auto-Exit/prompt feature (e.g. the
"UMB-WEBSITE-PREVIEW-ACCEPT"timeout cookie) has not been ported over to v14+ yet.How to test?
Try to reproduce the bugs raised in #19443 and #19471. e.g. repeatedly hitting reload whilst in preview mode.