fix(db): improve IndexedDB error handling and optimization#1433
Merged
fadi-george merged 8 commits intomainfrom Mar 3, 2026
Merged
fix(db): improve IndexedDB error handling and optimization#1433fadi-george merged 8 commits intomainfrom
fadi-george merged 8 commits intomainfrom
Conversation
7ef5e34 to
510377d
Compare
abdulraqeeb33
approved these changes
Mar 3, 2026
510377d to
9a42348
Compare
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.
Description
1 Line Summary
Improves IndexedDB error handling by adding database availability checks during initialization and optimizes database operations by replacing the idb library with a lightweight custom implementation.
See ticket: https://app.asana.com/1/780103692902078/project/1208777190614537/task/1213397971882709?focus=true
Details
IndexedDB is our local storage system for preserving info on subscription, user, and other details. Currently when a user goes to chrome settings to delete data from site:


It will corrupt the IDB so when going back to the tab and refreshing, the developer might see:

New changes will just one check in init and use our Log helper if there's an error.
UserNamespace) toUserclass since if IDB is not available, then we don't want to use Model info which may rely on IDB.OneSignal.User.<some-actionreally on user class being loaded in init but will remain undefined if IDB fails to load. Calls likeOneSIgnal.User.PushSubscription.optIn(not reliant onuser class) useawaitOneSignalInitAndSupportedwhich will be a floating/unresolvable promise. This means it won't preform any action/updates if IDB fails to load.Systems Affected
Validation
Tests
Info
Database client tests updated to work with the new custom IndexedDB implementation while maintaining existing functionality.
Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemapcontextif possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.contextScreenshots
Info
Checklist
Related Tickets
This change is