Skip to content

Commit 1f8c1c4

Browse files
authored
Merge pull request #132 from powersync-ja/fix/reintroduce-wait-for-first-sync
Reintroduce waitForFirstSync
2 parents bf297bf + ea48a2e commit 1f8c1c4

File tree

13 files changed

+68
-19
lines changed

13 files changed

+68
-19
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

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## 2024-07-29
7+
8+
### Changes
9+
10+
---
11+
12+
Packages with breaking changes:
13+
14+
- There are no breaking changes in this release.
15+
16+
Packages with other changes:
17+
18+
- [`powersync` - `v1.6.1`](#powersync---v161)
19+
- [`powersync_attachments_helper` - `v0.6.1`](#powersync_attachments_helper---v061)
20+
21+
---
22+
23+
#### `powersync` - `v1.6.1`
24+
25+
- **FIX**: Reintroduce waitForFirstSync.
26+
27+
#### `powersync_attachments_helper` - `v0.6.1`
28+
29+
- Update a dependency to the latest release.
30+
31+
632
## 2024-07-25
733

834
### Changes

demos/django-todolist/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ environment:
1010
dependencies:
1111
flutter:
1212
sdk: flutter
13-
powersync: ^1.6.0
13+
powersync: ^1.6.1
1414
path_provider: ^2.1.1
1515
path: ^1.8.3
1616
logging: ^1.2.0

demos/supabase-anonymous-auth/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
flutter:
1212
sdk: flutter
1313

14-
powersync: ^1.6.0
14+
powersync: ^1.6.1
1515
path_provider: ^2.1.1
1616
supabase_flutter: ^2.0.2
1717
path: ^1.8.3

demos/supabase-edge-function-auth/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
flutter:
1212
sdk: flutter
1313

14-
powersync: ^1.6.0
14+
powersync: ^1.6.1
1515
path_provider: ^2.1.1
1616
supabase_flutter: ^2.0.2
1717
path: ^1.8.3

demos/supabase-simple-chat/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependencies:
3737

3838
supabase_flutter: ^2.0.2
3939
timeago: ^3.6.0
40-
powersync: ^1.6.0
40+
powersync: ^1.6.1
4141
path_provider: ^2.1.1
4242
path: ^1.8.3
4343
logging: ^1.2.0

demos/supabase-todolist/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ environment:
1010
dependencies:
1111
flutter:
1212
sdk: flutter
13-
powersync_attachments_helper: ^0.6.0
14-
powersync: ^1.6.0
13+
powersync_attachments_helper: ^0.6.1
14+
powersync: ^1.6.1
1515
path_provider: ^2.1.1
1616
supabase_flutter: ^2.0.1
1717
path: ^1.8.3

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/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.6.1
2+
3+
- **FIX**: Reintroduce waitForFirstSync.
4+
15
## 1.6.0
26

37
- Web support is now included in the standard release but remains in alpha. Web support may have some limitations or bugs.

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)