Guided Tours: Bail if fresh user prefs missing #10822
Merged
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.
The Guided Tours framework tracks which tours a user has seen (completed or dismissed) by persisting that history using the Preferences API (
state.preferences
). Up to this point, it was missing an explicit check that the preferences available locally (viagetPreferences
) have been successfully pulled from the server and aren't stale. Without the check, GT assumed the history was empty (and thus any tour was good to show again). The check should guard against two issues:<QueryPreferences />
element), we ensure that GT waits for the preferences before deciding on a tour. [fig 1]fig 1:
fig 2:
To test
The best is likely to locally revert #10706, set
localStorage.setItem( 'debug', 'calypso:guided*' )
and test with different accounts (without 2FA, with 2FA and fresh token, with 2FA and stale token) and different histories (having seeneditorInsertMenu
, having not seen it).