Skip to content

Add recursive triggers for web #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 20, 2024
Merged
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
5 changes: 1 addition & 4 deletions demos/supabase-todolist/lib/powersync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ Future<void> openDatabase() async {

// Demo using SQLite Full-Text Search with PowerSync.
// See https://docs.powersync.com/usage-examples/full-text-search for more details
if (!kIsWeb) {
// FTS does not seem to work well on web currently
await configureFts(db);
}
await configureFts(db);
}

/// Explicit sign out - clear database and log out.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class FtsSearchDelegate extends SearchDelegate {
}

Future<List> _search() async {
if (query.isEmpty) return [];
List listsSearchResults = await fts_helpers.search(query, 'lists');
List todoItemsSearchResults = await fts_helpers.search(query, 'todos');
List formattedListResults = listsSearchResults
Expand Down
13 changes: 13 additions & 0 deletions packages/powersync/lib/src/open_factory/web/web_open_factory.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'dart:async';

import 'package:powersync/src/open_factory/abstract_powersync_open_factory.dart';
import 'package:powersync/src/uuid.dart';
import 'package:sqlite_async/sqlite3_common.dart';
import 'package:sqlite_async/sqlite_async.dart';

/// Web implementation for [AbstractPowerSyncOpenFactory]
class PowerSyncOpenFactory extends AbstractPowerSyncOpenFactory {
Expand All @@ -14,6 +17,16 @@ class PowerSyncOpenFactory extends AbstractPowerSyncOpenFactory {
// No op for web
}

@override
Future<SqliteConnection> openConnection(SqliteOpenOptions options) async {
var conn = await super.openConnection(options);
for (final statement in super.pragmaStatements(options)) {
await conn.execute(statement);
}

return super.openConnection(options);
}

@override

/// This is only called when synchronous connections are created in the same
Expand Down
Loading