Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Disallow observing on transaction for onupgradeneeded #37

@dmurph

Description

@dmurph

I'd like to disallow observing on the transaction given to the onupgradeneeded callback for the following reasons:

  1. This would observe ALL object stores, which could be a big performance hit depending on the implementation.
  2. 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.
  3. 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.

@bevis-tseng, @sicking, @inexorabletash, @pwnall: thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions