-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Refactor state classes to prepare for state corruption backup mitigation #29745
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [c5528f3]
Page Load Metrics (1995 ± 141 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Capture sentry error if there is an empty/corrupt vault, and handle more possible empty/corrupt vault types Ensure log.debug call in case fetch in init in ReadOnlyNetworkStore has an error without a message Ensure that in ReadOnlyNetworkStore waits for initializing to complete Lint fix Ensure that first time state is returned if state has no data Update app/scripts/lib/Stores/ExtensionStore.ts Co-authored-by: Danica Shen <[email protected]> Update test description Use const for DEFAULT_INITIAL_STATE in ExtensionStore.test.ts Improve naming and usage of versionedData variable in background.js lint fix Capture exception with sentry in both error cases ExtensionStore.get Lint fix Add app/scripts/lib/Stores/ReadOnlyNetworkStore.test.ts Delete files that are no longer used Use async/await for get/set in ExtensionStore.ts
c5528f3
to
3401019
Compare
Builds ready [bf23d04]
Page Load Metrics (1787 ± 79 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Co-authored-by: Mark Stacey <[email protected]>
Co-authored-by: Mark Stacey <[email protected]>
Co-authored-by: Mark Stacey <[email protected]>
Co-authored-by: Mark Stacey <[email protected]>
Co-authored-by: Mark Stacey <[email protected]>
Co-authored-by: Mark Stacey <[email protected]>
Co-authored-by: Mark Stacey <[email protected]>
Builds ready [7296ee9]
Page Load Metrics (1820 ± 97 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
app/scripts/background.js
Outdated
}); | ||
|
||
const localStore = inTest ? new ReadOnlyNetworkStore() : new ExtensionStore(); | ||
const persistanceManager = new PersistanceManager({ localStore }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
const persistanceManager = new PersistanceManager({ localStore }); | |
const persistenceManager = new PersistenceManager({ localStore }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in acd53a0
✅ Tested locally with
|
Builds ready [ee61d60]
Page Load Metrics (1707 ± 71 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [0b72887]
Page Load Metrics (1789 ± 93 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Builds ready [1aa223e]
Page Load Metrics (1898 ± 88 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
LGTM ! |
Description
This PR replaces #24016
This PR does the following:
Refactors
local-store.js
andnetwork-store.js
toExtensionStore.ts
andReadOnlyNetworkStore.ts
. These two classes are extensions of the newBaseStore
class.The new
BaseStore
class: "is an abstract class designed to be extended by other classes that implement the abstract methodsset
andget
. This class provides the foundation for different storage implementations, enabling them to adhere to a consistent interface for retrieving and setting application state." In future PRs, new classes that use the indexeddb api, and the localStorage api in the offscreen document, will be added that also extend the BaseStore class.The BaseStore class has a simple interface with just a
get
andset
method. Accordingly,ExtensionSotre
andReadOnlyNetworkStore
are significantly simplified compared to their predecessors. The functionality for managing data (e.g. handling error states, handling metadata, etc) that used to be inlocal-store.js
andnetwork-store.js
is now in a newPersistanceManager
class.The new
PersistanceManager
class: "The PersistanceManager class serves as a high-level manager for handling storage-related operations using a local storage system. It provides methods to read and write state, manage metadata, and handle errors or corruption in the underlying storage system."This is a step towards providing a fail safe for state corruption. The new classes will be utilized for this additional functionality.
Related issues
Fixes:
Manual testing steps
No functional changes should have occurred. Manual regression cases to test include:
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist