Skip to content

Commit 07bdba5

Browse files
remove advanced differentiator from demo.
1 parent f0fdd23 commit 07bdba5

File tree

2 files changed

+40
-42
lines changed

2 files changed

+40
-42
lines changed

demos/react-supabase-todolist/src/app/views/todo-lists/edit/page.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
} from '@mui/material';
2020
import Fab from '@mui/material/Fab';
2121
import { usePowerSync, useQuery } from '@powersync/react';
22-
import { DEFAULT_WATCHED_QUERY_DIFFERENTIATOR } from '@powersync/web';
2322
import React, { Suspense } from 'react';
2423
import { useParams } from 'react-router-dom';
2524

@@ -59,10 +58,7 @@ const TodoEditSection = () => {
5958
created_at DESC,
6059
id
6160
`,
62-
[listID],
63-
{
64-
differentiator: DEFAULT_WATCHED_QUERY_DIFFERENTIATOR
65-
}
61+
[listID]
6662
);
6763

6864
const [showPrompt, setShowPrompt] = React.useState(false);

tools/powersynctests/src/tests/queries.test.ts

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -619,43 +619,7 @@ export function registerBaseTests() {
619619
expect(duration).lessThan(2000);
620620
});
621621

622-
it('Should handle multiple closes', async () => {
623-
// Bulk insert 10000 rows without using a transaction
624-
const bulkInsertCommands = [];
625-
const statement = `INSERT INTO t1(id, c) VALUES(uuid(), ?)`;
626-
627-
for (let i = 0; i < 10000; i++) {
628-
bulkInsertCommands.push([[`value${i + 1}`]]);
629-
}
630-
631-
await db.executeBatch(statement, bulkInsertCommands);
632-
await db.close();
633-
634-
for (let i = 1; i < 10; i++) {
635-
db = createDatabase();
636-
await db.init();
637-
638-
// ensure a regular query works
639-
const pExecute = await db.execute(`SELECT * FROM t1 `);
640-
expect(pExecute.rows?.length).to.equal(10000);
641-
642-
// Queue a bunch of write locks, these will fail due to the db being closed
643-
// before they are accepted.
644-
const tests = [
645-
db.execute(`SELECT * FROM t1 `),
646-
db.execute(`SELECT * FROM t1 `),
647-
db.execute(`SELECT * FROM t1 `),
648-
db.execute(`SELECT * FROM t1 `)
649-
];
650-
651-
await db.close();
652-
653-
const results = await Promise.allSettled(tests);
654-
expect(results.map((r) => r.status)).deep.equal(Array(tests.length).fill('rejected'));
655-
}
656-
});
657-
658-
it('should compare results with old watch method', async () => {
622+
it('should compare results with old watch method', async () => {
659623
const controller = new AbortController();
660624

661625
const resultSets: QueryResult[] = [];
@@ -703,5 +667,43 @@ export function registerBaseTests() {
703667
// We should only have updated less than or equal 3 times
704668
expect(resultSets.length).lessThanOrEqual(3);
705669
});
670+
671+
it('Should handle multiple closes', async () => {
672+
// Bulk insert 10000 rows without using a transaction
673+
const bulkInsertCommands = [];
674+
const statement = `INSERT INTO t1(id, c) VALUES(uuid(), ?)`;
675+
676+
for (let i = 0; i < 10000; i++) {
677+
bulkInsertCommands.push([[`value${i + 1}`]]);
678+
}
679+
680+
await db.executeBatch(statement, bulkInsertCommands);
681+
await db.close();
682+
683+
for (let i = 1; i < 10; i++) {
684+
db = createDatabase();
685+
await db.init();
686+
687+
// ensure a regular query works
688+
const pExecute = await db.execute(`SELECT * FROM t1 `);
689+
expect(pExecute.rows?.length).to.equal(10000);
690+
691+
// Queue a bunch of write locks, these will fail due to the db being closed
692+
// before they are accepted.
693+
const tests = [
694+
db.execute(`SELECT * FROM t1 `),
695+
db.execute(`SELECT * FROM t1 `),
696+
db.execute(`SELECT * FROM t1 `),
697+
db.execute(`SELECT * FROM t1 `)
698+
];
699+
700+
await db.close();
701+
702+
const results = await Promise.allSettled(tests);
703+
expect(results.map((r) => r.status)).deep.equal(Array(tests.length).fill('rejected'));
704+
}
705+
});
706+
707+
706708
});
707709
}

0 commit comments

Comments
 (0)