Repository navigation
fix(connect-multichain): recover StoreAdapterWeb after IndexedDB is force-closed - #351
Open
joaoloureirop wants to merge 2 commits into
Open
joaoloureirop wants to merge 2 commits into
joaoloureirop wants to merge 2 commits into
Conversation
…orce-closed Drop the cached IDBDatabase on close/versionchange and retry get/set/delete once so pairing storage keeps working without a page reload (MCWP-821). Co-authored-by: Cursor <cursoragent@cursor.com>
…est failures Connection-loss errors still surface so StoreAdapterWeb can retry once. Other request failures keep the existing Failed to get/set/delete messages. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
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.
Explanation
StoreAdapterWebopened IndexedDB once in the constructor and cached thatIDBDatabasefor the page lifetime, with noclose/versionchangehandling. When the browser or WKWebView force-closes the connection (Fireblocks saw this in a React Native WebView and on web), laterget/set/deletefail withInvalidStateError("The database connection is closing") orUnknownError("Connection to Indexed Database server lost") until a full reload.This change keeps a reconnectable handle instead of a one-shot promise:
oncloseandonversionchangeand invalidate the cached connection so the next op opens a new one.get/set/deleteonce after those recoverable errors.request.errorso connection-lost failures can trigger recovery instead of being wrapped as a genericError.Native RN
AsyncStorageis unchanged. Customstorageoverrides are unchanged.Closing after every write (the partner workaround) is slower; this prefers reopen-on-close.
Fixes: MCWP-821
References
Checklist
Made with Cursor