Add option to make storage persistent to Offline page. - #1274
Merged
Merged
Conversation
pwnall
force-pushed
the
add-persistence
branch
from
September 14, 2020 04:32
d616cf9 to
611a97d
Compare
What do you think of also adding sign up feature to enable user saved data persist even when caches are cleared |
The preceding commit was transliterated from CoffeeScript, which main
has since converted to JavaScript. These three defects come from the
original and are fixed here rather than silently during the port:
* the persistence note added one more </div> than it opened
* checkPersistence's catch handler passed `persisted`, which is only
bound inside the then handler, so a rejected persisted() raised a
ReferenceError instead of reporting that persistence is unavailable
* the button's class attribute was written `class =`
navigator.storage.persist() resolves false without raising whenever the browser declines -- Chrome when its heuristics are unmet, Firefox when the prompt is dismissed -- so the denial path is one users hit in the course of normal use, not an exceptional one. Rendering it through the page-level error template replaced the whole view, discarding the documentation table, so a declined request left no way back other than navigating away and returning. Write the outcome to the #_offline-persistence-note container the note already carries an id for, and style the message as an inline note: ._error is centred with position: absolute and cannot be nested.
Querying persistence made render() finish asynchronously, so the this.activated check it performs beforehand no longer holds by the time the page is written. Re-check it in both callbacks, as the surrounding install callbacks already do.
simon04
force-pushed
the
add-persistence
branch
from
September 14, 2026 06:40
611a97d to
853b493
Compare
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.
Fixes #703
I tested this manually and it works for me in Chrome.
I looked around a bit and focused on getting something working. I probably got the architecture bits wrong -- I'd be happy to update my PR in response to architectural feedback.
I hope this helps!