Skip to content

2.1.0

Choose a tag to compare

@BJNSTNKVC BJNSTNKVC released this 26 Sep 10:48
· 10 commits to master since this release

Added

  • database-version-changed event, dispatched when another tab upgrades or deletes the database a
    connection holds open. Previously the connection closed its handle silently, and the application
    only found out when its next query failed with MigrationMismatchException. The event carries
    database and version, where version is the version the other tab is opening, or null when
    it is deleting the database.
  • DB.onDatabaseVersionChanged() to listen for it, and the DatabaseVersionChanged class exported
    from the package.

The event is dispatched after the connection has closed its handle, so the other tab's upgrade is
never blocked while listeners run. Reloading the page is the right response. Querying again reopens
the database at the older version and fails:

DB.onDatabaseVersionChanged((event: DatabaseVersionChanged): void => {
    if (confirm('A new version is available. Reload now?')) {
        location.reload();
    }
});