You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 16, 2023. It is now read-only.
I'd like to disallow observing on the transaction given to the onupgradeneeded callback for the following reasons:
This would observe ALL object stores, which could be a big performance hit depending on the implementation.
This would be the easiest copy-paste way to add observers, which (based on past usages of things) would get copy-pasted from stackoverflow or elsewhere, making the least-performant observer the default.
The user can instead just add the observer in onsuccess, which they would have to do anyways if there isn't an upgrade event (where it's just openning the db).
Another option offered by @pwnall is to add a sub-scoping option where in the .observe call, the user can specifically specify a sub-scope of object stores (where they would need to be also in that transaction). Then if one wanted to observe the onupgradeneeded transaction (which has a scope of all object stores), the user could specify only the ones they want.
I think this adds too much complexity, especially because the user would want to handle the non-upgrade-needed case anyways where they read the initial state and add an observer, which should solve this issue.