Document persistence model and add gf-persistent flag#175
Merged
Conversation
Trainer pages use localStorage (permanent); student pages use sessionStorage (per-session). Previously the only way to opt into trainer persistence was an anchor with exact text "ANALYSIS", and the behaviour was undocumented. - Add a second, explicit trigger: an element with id "gf-persistent" anywhere on the page now also selects trainer (localStorage) persistence, alongside the existing ANALYSIS-anchor detection. - Document both detection criteria and the trainer/student storage model in the README. - Add a persistent-flag fixture and tests covering the new flag. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0183n3qwA6ssJ8m6UJVUwhid
Contributor
PR PreviewPreview deployment is ready! View Preview Last updated: 2026-06-25T15:53:56.214Z |
Merged
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.
Summary
Annotations are persisted to browser storage with two different models depending on context: trainer pages use
localStorage(permanent), student pages usesessionStorage(cleared on session close). Until now the only way to select trainer persistence was an<a>anchor with exact textANALYSIS, and this behaviour was completely undocumented.This PR:
id="gf-persistent"anywhere on the page now also selects trainer (localStorage) persistence, alongside the existing ANALYSIS-anchor detection. This gives integrators a clear, intentional opt-in that doesn't depend on incidental link text.persistent-flag-page.htmlfixture plus two tests verifying that a page carrying#gf-persistentwrites tolocalStorage(notsessionStorage) and that annotations survive a reload.Detection logic (
src/core/storage.js)A page is treated as trainer context if either:
id="gf-persistent"exists, orANALYSISexists.Otherwise it is student context. The
#gf-persistentcheck runs first; existing behaviour is unchanged.Testing
All 16 tests in
tests/storage.spec.jspass, including the 2 newgf-persistenttests.🤖 Generated with Claude Code
Generated by Claude Code