Skip to content

Prevent completing futures twice for web #104

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 2 commits into from
Jun 24, 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
2 changes: 1 addition & 1 deletion demos/supabase-anonymous-auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ packages:
path: "../../packages/powersync"
relative: true
source: path
version: "1.3.0-alpha.4"
version: "1.3.0-alpha.6"
realtime_client:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions demos/supabase-anonymous-auth/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: supabase_anonymous_auth
description: PowerSync Supabase Anonymous Auth Demo
publish_to: 'none'
publish_to: "none"

version: 1.0.1

Expand All @@ -11,7 +11,7 @@ dependencies:
flutter:
sdk: flutter

powersync: ^1.3.0-alpha.5
powersync: ^1.3.0-alpha.6
path_provider: ^2.1.1
supabase_flutter: ^2.0.2
path: ^1.8.3
Expand Down
2 changes: 1 addition & 1 deletion demos/supabase-edge-function-auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ packages:
path: "../../packages/powersync"
relative: true
source: path
version: "1.3.0-alpha.4"
version: "1.3.0-alpha.6"
realtime_client:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions demos/supabase-edge-function-auth/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: supabase_jwt_auth
description: PowerSync Supabase JWT Auth Demo
publish_to: 'none'
publish_to: "none"

version: 1.0.1

Expand All @@ -11,7 +11,7 @@ dependencies:
flutter:
sdk: flutter

powersync: ^1.3.0-alpha.5
powersync: ^1.3.0-alpha.6
path_provider: ^2.1.1
supabase_flutter: ^2.0.2
path: ^1.8.3
Expand Down
2 changes: 1 addition & 1 deletion demos/supabase-simple-chat/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ packages:
path: "../../packages/powersync"
relative: true
source: path
version: "1.3.0-alpha.4"
version: "1.3.0-alpha.6"
realtime_client:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions demos/supabase-simple-chat/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: supabase_tutorial_chat_app
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: "none" # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
Expand Down Expand Up @@ -37,7 +37,7 @@ dependencies:

supabase_flutter: ^1.10.25
timeago: ^3.6.0
powersync: ^1.3.0-alpha.5
powersync: ^1.3.0-alpha.6
path_provider: ^2.1.1
path: ^1.8.3
logging: ^1.2.0
Expand Down
24 changes: 12 additions & 12 deletions demos/supabase-todolist/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ PODS:
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- "sqlite3 (3.45.3+1)":
- "sqlite3/common (= 3.45.3+1)"
- "sqlite3/common (3.45.3+1)"
- "sqlite3/fts5 (3.45.3+1)":
- sqlite3 (3.46.0):
- sqlite3/common (= 3.46.0)
- sqlite3/common (3.46.0)
- sqlite3/fts5 (3.46.0):
- sqlite3/common
- "sqlite3/perf-threadsafe (3.45.3+1)":
- sqlite3/perf-threadsafe (3.46.0):
- sqlite3/common
- "sqlite3/rtree (3.45.3+1)":
- sqlite3/rtree (3.46.0):
- sqlite3/common
- sqlite3_flutter_libs (0.0.1):
- Flutter
- "sqlite3 (~> 3.45.3+1)"
- sqlite3 (~> 3.46.0)
- sqlite3/fts5
- sqlite3/perf-threadsafe
- sqlite3/rtree
Expand Down Expand Up @@ -61,11 +61,11 @@ SPEC CHECKSUMS:
app_links: e70ca16b4b0f88253b3b3660200d4a10b4ea9795
camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqlite3: 02d1f07eaaa01f80a1c16b4b31dfcbb3345ee01a
sqlite3_flutter_libs: 9bfe005308998aeca155330bbc2ea6dddf834a3b
url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqlite3: 154b084339ede06960a5b3c8160066adc9176b7d
sqlite3_flutter_libs: 0d611efdf6d1c9297d5ab03dab21b75aeebdae31
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: f7b3cb7384a2d5da4b22b090e1f632de7f377987

Expand Down
32 changes: 16 additions & 16 deletions demos/supabase-todolist/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ packages:
dependency: transitive
description:
name: camera_android
sha256: "3af7f0b55f184d392d2eec238aaa30552ebeef2915e5e094f5488bf50d6d7ca2"
sha256: b350ac087f111467e705b2b76cc1322f7f5bdc122aa83b4b243b0872f390d229
url: "https://pub.dev"
source: hosted
version: "0.10.9+3"
version: "0.10.9+2"
camera_avfoundation:
dependency: transitive
description:
Expand Down Expand Up @@ -194,10 +194,10 @@ packages:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: c6b0b4c05c458e1c01ad9bcc14041dd7b1f6783d487be4386f793f47a8a4d03e
sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f"
url: "https://pub.dev"
source: hosted
version: "2.0.20"
version: "2.0.19"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -372,10 +372,10 @@ packages:
dependency: transitive
description:
name: path_provider_android
sha256: "9c96da072b421e98183f9ea7464898428e764bc0ce5567f27ec8693442e72514"
sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d
url: "https://pub.dev"
source: hosted
version: "2.2.5"
version: "2.2.4"
path_provider_foundation:
dependency: transitive
description:
Expand Down Expand Up @@ -446,14 +446,14 @@ packages:
path: "../../packages/powersync"
relative: true
source: path
version: "1.3.0-alpha.4"
version: "1.3.0-alpha.6"
powersync_attachments_helper:
dependency: "direct main"
description:
path: "../../packages/powersync_attachments_helper"
relative: true
source: path
version: "0.3.0-alpha.1"
version: "0.3.0-alpha.2"
realtime_client:
dependency: transitive
description:
Expand Down Expand Up @@ -490,10 +490,10 @@ packages:
dependency: transitive
description:
name: shared_preferences_android
sha256: "93d0ec9dd902d85f326068e6a899487d1f65ffcd5798721a95330b26c8131577"
sha256: "1ee8bf911094a1b592de7ab29add6f826a7331fb854273d55918693d5364a1f2"
url: "https://pub.dev"
source: hosted
version: "2.2.3"
version: "2.2.2"
shared_preferences_foundation:
dependency: transitive
description:
Expand Down Expand Up @@ -679,10 +679,10 @@ packages:
dependency: transitive
description:
name: url_launcher_android
sha256: ceb2625f0c24ade6ef6778d1de0b2e44f2db71fded235eb52295247feba8c5cf
sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9"
url: "https://pub.dev"
source: hosted
version: "6.3.3"
version: "6.3.2"
url_launcher_ios:
dependency: transitive
description:
Expand Down Expand Up @@ -775,10 +775,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4
sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb"
url: "https://pub.dev"
source: hosted
version: "5.5.1"
version: "5.5.0"
xdg_directories:
dependency: transitive
description:
Expand All @@ -804,5 +804,5 @@ packages:
source: hosted
version: "2.0.0"
sdks:
dart: ">=3.4.0 <4.0.0"
flutter: ">=3.22.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.19.0"
4 changes: 2 additions & 2 deletions demos/supabase-todolist/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: powersync_flutter_demo
description: PowerSync Flutter Demo
publish_to: 'none'
publish_to: "none"

version: 1.0.1

Expand All @@ -12,7 +12,7 @@ dependencies:
sdk: flutter
powersync_attachments_helper: ^0.3.0-alpha.2

powersync: ^1.3.0-alpha.5
powersync: ^1.3.0-alpha.6
path_provider: ^2.1.1
supabase_flutter: ^2.0.1
path: ^1.8.3
Expand Down
4 changes: 4 additions & 0 deletions packages/powersync/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.0-alpha.6

- Fix `Bad state: Future already completed` error when calling `disconnectAndClear()`.

## 1.3.1

- Fix "Checksum mismatch" issue when calling `PowerSyncDatabase.connect` multiple times.
Expand Down
8 changes: 6 additions & 2 deletions packages/powersync/lib/src/abort_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ class AbortController {
/// Abort, and wait until aborting is complete.
Future<void> abort() async {
aborted = true;
_abortRequested.complete();
if (!_abortRequested.isCompleted) {
_abortRequested.complete();
}

await _abortCompleter.future;
}

/// Signal that an abort has completed.
void completeAbort() {
_abortCompleter.complete();
if (!_abortCompleter.isCompleted) {
_abortCompleter.complete();
}
}

/// Signal that an abort has failed.
Expand Down
4 changes: 2 additions & 2 deletions packages/powersync/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: powersync
version: 1.3.0-alpha.5
version: 1.3.0-alpha.6
homepage: https://powersync.com
repository: https://github.com/powersync-ja/powersync.dart
description: PowerSync Flutter SDK - keep PostgreSQL databases in sync with on-device SQLite databases.
Expand Down Expand Up @@ -27,7 +27,7 @@ dev_dependencies:
test: ^1.25.0
test_api: ^0.7.0
path_provider: ^2.0.13
sqlite3: '>2.3.0 <2.4.3'
sqlite3: ">2.3.0 <2.4.3"
shelf: ^1.4.1
shelf_router: ^1.1.4
shelf_static: ^1.1.2
Expand Down
4 changes: 2 additions & 2 deletions packages/powersync_attachments_helper/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ dependencies:
flutter:
sdk: flutter

powersync: ^1.3.0-alpha.5
powersync: ^1.3.0-alpha.6
logging: ^1.2.0
sqlite3: '>2.3.0 <2.4.3'
sqlite3: ">2.3.0 <2.4.3"
sqlite_async: ^0.7.0-alpha.4
path_provider: ^2.0.13

Expand Down
Loading