Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sqlite3/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 3.6.0 (unreleased)

- Fix `IndexedDbFileSystem.flush()` completing before a write batch already in progress was persisted.
- Hooks: Support relative paths in `additional_includes` and `additional_lib_directories`.
- Hooks: Support multiple source files to compile with `source: source`.
- Hooks: `source` and `name` accept a map with per-OS entries and a `default` (e.g. `source: {android: system, default: sqlite3}`). Names containing a path (like `foo.framework/foo`) are passed to the loader as-is with `source: system`.
Expand Down
11 changes: 10 additions & 1 deletion sqlite3/lib/src/wasm/vfs/indexed_db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,16 @@ final class IndexedDbFileSystem extends BaseVirtualFileSystem {
/// Operations started after this [flush] call will not be awaited by the
/// returned future.
Future<void> flush() {
return _startWorkingIfNeeded(isImplicit: false);
if (!_isWorking) {
return _startWorkingIfNeeded(isImplicit: false);
}

// A batch is already being written, so `_startWorkingIfNeeded` would take
// no branch and complete immediately — before that batch, or anything
// queued behind it, reaches IndexedDB. Queue a no-op item instead: it lands
// at the tail of `_pendingWork` and completes only once the work ahead of
// it has been written, which is the guarantee documented above.
return _submitWorkFunction((_) async {}, 'flush');
}

@override
Expand Down