Skip to content

Commit 815317c

Browse files
committed
fix: Reintroduce waitForFirstSync
1 parent bf297bf commit 815317c

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
# This action is not compatible with tags such as `powersync-v1.1.1`
1010
# marvinpinto/action-automatic-releases struggles to generate changelogs
1111
# Be sure to manually tag the commit to trigger this action
12-
- 'v*'
12+
- "powersync-v[0-9]+.[0-9]+.[0-9]+"
1313

1414
jobs:
1515
build:
@@ -22,8 +22,8 @@ jobs:
2222
- name: Install Flutter
2323
uses: subosito/flutter-action@v2
2424
with:
25-
flutter-version: '3.x'
26-
channel: 'stable'
25+
flutter-version: "3.x"
26+
channel: "stable"
2727

2828
- name: Install Melos
2929
run: flutter pub global activate melos
@@ -32,10 +32,8 @@ jobs:
3232
run: melos prepare
3333

3434
- name: Create Draft Release
35-
uses: 'marvinpinto/action-automatic-releases@latest'
36-
with:
37-
repo_token: '${{ secrets.GITHUB_TOKEN }}'
38-
prerelease: true # TODO update when out of alpha
39-
draft: true
40-
files: |
41-
assets/powersync_db.worker.js
35+
run: |
36+
tag="${{ github.ref_name }}"
37+
body="Release $tag"
38+
gh release create --draft "$tag" --title "$tag" --notes "$body" --generate-notes --prerelease
39+
gh release upload "${{ github.ref_name }}" assets/powersync_db.worker.js

melos.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ packages:
88
ide:
99
intellij: false
1010

11+
command:
12+
version:
13+
packageFilters:
14+
noPrivate: true
15+
1116
scripts:
1217
prepare: melos bootstrap && dart ./scripts/compile_webworker.dart && dart ./scripts/init_sqlite_wasm.dart && dart ./scripts/init_powersync_core_binary.dart
1318

packages/powersync/lib/src/database/powersync_db_mixin.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
104104
}
105105
}
106106

107+
/// Returns a [Future] which will resolve once the first full sync has completed.
108+
Future<void> waitForFirstSync() async {
109+
if (currentStatus.hasSynced ?? false) {
110+
return;
111+
}
112+
await for (final result in statusStream) {
113+
if (result.hasSynced ?? false) {
114+
break;
115+
}
116+
}
117+
}
118+
107119
@protected
108120
void setStatus(SyncStatus status) {
109121
if (status != currentStatus) {

0 commit comments

Comments
 (0)