Conversation
WalkthroughRemoved unused public imports from the Dexie Cloud test file and added/expanded test scaffolding that opens, syncs, modifies, and validates data (issue #1922). Also reformatted and adjusted several Dexie Cloud test sequences (issue #2185) and standardized transaction callback signatures. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Test as Tests (unit)
participant Client as dexie-cloud-client
participant Realm as Local Realm/DB
participant Server as Dexie Cloud Server
Note over Test,Client: Test scaffolding opens client and triggers sync
Test->>Client: open() / start sync
Client->>Realm: apply local mutations (tx)
Client->>Server: push local changes / request updates
Server-->>Client: send remote updates / acks
Client->>Realm: apply remote updates
Realm-->>Test: confirm data state
Note right of Test: Assertions and validations
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)addons/dexie-cloud/test/unit/tests-github-issues.ts (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
addons/dexie-cloud/test/unit/tests-github-issues.ts(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
addons/dexie-cloud/test/unit/tests-github-issues.ts (1)
addons/dexie-cloud/src/dexie-cloud-client.ts (1)
dexieCloud(76-501)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: test (addons/y-dexie/test)
- GitHub Check: test (libs/dexie-react-hooks/test)
- GitHub Check: test (addons/dexie-export-import/test)
- GitHub Check: test (addons/Dexie.Syncable/test)
- GitHub Check: test (test)
- GitHub Check: test (addons/Dexie.Observable/test)
| await db.transaction('rw', db.items2185, db.members, db.realms, (tx) => { | ||
| tx.items2185.clear(); | ||
| tx.members.where({ realmId: REALM_ID }).delete(); | ||
| tx.realms.delete(REALM_ID); | ||
| }); |
There was a problem hiding this comment.
Fix transaction table access
Dexie.Transaction doesn’t expose tables as direct properties, so tx.items2185/tx.members/tx.realms are undefined. The first call to tx.items2185.clear() throws, breaking both the initial cleanup and the final cleanup for this test. Use the already-bound table instances from db (or tx.table('items2185')) instead.
- await db.transaction('rw', db.items2185, db.members, db.realms, (tx) => {
- tx.items2185.clear();
- tx.members.where({ realmId: REALM_ID }).delete();
- tx.realms.delete(REALM_ID);
+ await db.transaction('rw', db.items2185, db.members, db.realms, () => {
+ db.items2185.clear();
+ db.members.where({ realmId: REALM_ID }).delete();
+ db.realms.delete(REALM_ID);
});
@@
- await db.transaction('rw', db.items2185, db.members, db.realms, (tx) => {
- tx.items2185.clear();
- tx.members.where({ realmId: REALM_ID }).delete();
- tx.realms.delete(REALM_ID);
+ await db.transaction('rw', db.items2185, db.members, db.realms, () => {
+ db.items2185.clear();
+ db.members.where({ realmId: REALM_ID }).delete();
+ db.realms.delete(REALM_ID);
});Also applies to: 169-173
🤖 Prompt for AI Agents
In addons/dexie-cloud/test/unit/tests-github-issues.ts around lines 102-106 (and
similarly at 169-173), the transaction callback incorrectly accesses tables via
tx.items2185/tx.members/tx.realms which are undefined; use the already-bound db
table instances or tx.table('tableName') instead. Update the transaction to call
operations on db.items2185, db.members.where(...).delete(), and
db.realms.delete(REALM_ID) (or replace each tx.X with tx.table('X')) so the
transaction uses valid Table objects and no longer throws on the first access.
This PR is currently failing as it reproduces issue #1922. When the bug is solved in dexie.cloud service, please rerun the tests.
Summary by CodeRabbit