fix: ensure default store data is merged with persisted data during VisualizationStore initialization #6231
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.
Details
When there is persisted data in IndexedDB for the
VisualizationStore
andstoreData.tests
is missing themediumPass
key, theWebConfigurationVisualizationFactory
hits an error. This PR overridesgenerateDefaultState
forVisualizationStore
(called duringinitialize()
), allowing us to ensure that default state is generated for test modes not present inpersistedData
. This implementation is based onAssessmentStore
, which is the only other store that overrides this method. It pulls initial data generation logic into a separate class to facilitate testing.Motivation
This PR addresses an issue seen in Canary where adhoc visualizations are nonfunctional and the service worker logs the following error:
Error while processing browser RuntimeOnMessage event: TypeError: Cannot read properties of undefined (reading 'keyboardInteractionAssessment')
Pull request checklist
yarn null:autoadd
yarn fastpass
yarn test
)<rootDir>/test-results/unit/coverage
fix:
,chore:
,feat(feature-name):
,refactor:
). SeeCONTRIBUTING.md
.