Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' of github.com:powersync-ja/powersync-web-sdk into…
Browse files Browse the repository at this point in the history
… yjs-text-collab-demo
  • Loading branch information
cahofmeyr committed Jan 15, 2024
2 parents be17f07 + e5fcd40 commit b6f65b6
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 17 deletions.
8 changes: 8 additions & 0 deletions demos/example-vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# example-vite

## 0.0.2

### Patch Changes

- Updated dependencies [7fb9df2]
- Updated dependencies [7fb9df2]
- @journeyapps/powersync-sdk-web@0.1.2

## 0.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion demos/example-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "example-vite",
"private": true,
"version": "0.0.1",
"version": "0.0.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
8 changes: 8 additions & 0 deletions demos/example-webpack/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@

### Patch Changes

- Updated dependencies [7fb9df2]
- Updated dependencies [7fb9df2]
- @journeyapps/powersync-sdk-web@0.1.2

## null

### Patch Changes

- Updated dependencies [0e17713]
- @journeyapps/powersync-sdk-web@0.1.1
9 changes: 9 additions & 0 deletions demos/powersync-nextjs-demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @journeyapps/powersync-nextjs-demo

## 0.1.6

### Patch Changes

- 7fb9df2: Autofocus inputs in creation dialogs for a better UX.
- Updated dependencies [7fb9df2]
- Updated dependencies [7fb9df2]
- @journeyapps/powersync-sdk-web@0.1.2

## 0.1.5

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions demos/powersync-nextjs-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@journeyapps/powersync-nextjs-demo",
"version": "0.1.5",
"version": "0.1.6",
"private": true,
"scripts": {
"build": "next build",
Expand All @@ -14,7 +14,7 @@
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fontsource/roboto": "^5.0.8",
"@journeyapps/powersync-react": "1.0.0",
"@journeyapps/powersync-react": "1.0.1",
"@journeyapps/powersync-sdk-web": "workspace:*",
"@journeyapps/wa-sqlite": "~0.1.0",
"@mui/icons-material": "^5.14.16",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const TodoEditSection = () => {
<DialogTitle id="alert-dialog-title">{'Create Todo Item'}</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">Enter a description for a new todo item</DialogContentText>
<TextField sx={{ marginTop: '10px' }} fullWidth inputRef={nameInputRef} label="Name" />
<TextField sx={{ marginTop: '10px' }} fullWidth inputRef={nameInputRef} autoFocus label="Name" />
</DialogContent>
<DialogActions>
<Button onClick={() => setShowPrompt(false)}>Cancel</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function TodoListsPage() {
<DialogTitle id="alert-dialog-title">{'Create Todo List'}</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">Enter a name for a new todo list</DialogContentText>
<TextField sx={{ marginTop: '10px' }} fullWidth inputRef={nameInputRef} label="Name" />
<TextField sx={{ marginTop: '10px' }} fullWidth inputRef={nameInputRef} label="Name" autoFocus />
</DialogContent>
<DialogActions>
<Button onClick={() => setShowPrompt(false)}>Cancel</Button>
Expand Down
7 changes: 7 additions & 0 deletions packages/powersync-sdk-web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @journeyapps/powersync-sdk-web

## 0.1.2

### Patch Changes

- 7fb9df2: Fix bug where opening multiple WA-SQLite instances would erase DB table change watches.
- 7fb9df2: Update common SDK dependency to v1.0.1: Improved connector CRUD uploads to be triggered whenever an internal CRUD operation change is triggered. Improved CRUD upload debouncing to rather use a throttled approach - executing multiple continuous write/CRUD operations will now trigger a connector upload at most (every) 1 second (by default).

## 0.1.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/powersync-sdk-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@journeyapps/powersync-sdk-web",
"version": "0.1.1",
"version": "0.1.2",
"description": "A Web SDK for JourneyApps PowerSync",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -41,7 +41,7 @@
"@journeyapps/wa-sqlite": "~0.1.0"
},
"dependencies": {
"@journeyapps/powersync-sdk-common": "1.0.0",
"@journeyapps/powersync-sdk-common": "1.0.1",
"async-mutex": "^0.4.0",
"comlink": "^4.4.1",
"js-logger": "^1.6.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export abstract class AbstractWebPowerSyncDatabaseOpenFactory extends AbstractPo
}

return {
...this.options,
database: isServerSide ? new SSRDBAdapter() : this.openDB(),
schema: this.schema,
flags: resolvedFlags
Expand Down
3 changes: 2 additions & 1 deletion packages/powersync-sdk-web/src/worker/db/open-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export type WASQLiteExecuteMethod = (sql: string, params?: any[]) => Promise<WAS
export type OnTableChangeCallback = (opType: number, tableName: string, rowId: number) => void;
export type OpenDB = (dbFileName: string) => DBWorkerInterface;

const listeners = new Map<string, OnTableChangeCallback>();

export async function _openDB(dbFileName: string): Promise<DBWorkerInterface> {
const { default: moduleFactory } = await import('@journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs');
const module = await moduleFactory();
Expand All @@ -34,7 +36,6 @@ export async function _openDB(dbFileName: string): Promise<DBWorkerInterface> {
sqlite3.vfs_register(vfs, true);

const db = await sqlite3.open_v2(dbFileName);
const listeners = new Map<string, OnTableChangeCallback>();

sqlite3.register_table_onchange_hook(db, (opType: number, tableName: string, rowId: number) => {
Array.from(listeners.values()).forEach((l) => l(opType, tableName, rowId));
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b6f65b6

Please sign in to comment.