Skip to content

Conversation

@simolus3
Copy link
Contributor

@simolus3 simolus3 commented Oct 30, 2025

This updates package:sqlite3_web to version 0.4.0. That version comes with a few new features, most notably:

  1. OPFS support on Chrome without special headers! By using readwrite-unsafe as an opening mode when opening sync file handles, multiple tabs can open the same database concurrently. sqlite3_web will internally guard concurrent access with web locks to avoid contention on the file (since we still can't implement xLock synchronously).
  2. Internal lock management. Since sqlite3_web needs locks for 1, those are now exposed in its API too. So, instead of using a custom protocol for lock management, we can just use sqlite3_web APIs here.
  3. Automatic autocommit state checks: This package used to rely on custom requests for statements in transactions to verify the autocommit state before running statements in the transaction. Version 0.4.0 makes this simpler, since:
    • for database calls, we can pass checkInTransaction: true to make sqlite3_web reject the statement if the database is not in a transaction.
    • after each database call, we also get the autocommit state back automatically.

These features allow deleting a fair bit of logic here since we have that in slqite3_web now.

With these changes, new users on Chrome would get an OPFS database (it used to be IndexedDB before unless COOP + COEP headers were enabled):

grafik

There are checks in sqlite3_web ensuring that an IndexedDB database would be re-used if it exists.

@simolus3 simolus3 marked this pull request as ready for review October 31, 2025 11:26
Copy link
Contributor

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very nice. The added OPFS support option and removal of code here are very very cool.

@simolus3 simolus3 merged commit 07ace50 into main Oct 31, 2025
8 checks passed
@simolus3 simolus3 deleted the sqlite3-update branch October 31, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants