From a364e7e510082a911ae3055e88391d7b8a07b50f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 May 2026 11:00:59 +0000 Subject: [PATCH 1/3] Update dependency deno to v2.7.14 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46030236da0..5eb66283df9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1087,7 +1087,7 @@ jobs: - uses: denoland/setup-deno@v2 with: # https://github.com/denoland/deno/releases - deno-version: "2.6.5" + deno-version: "2.7.14" - name: run deno tests:dexie run: | sudo npm i -g cross-env From 908910bfded8e4e324322c898e11b6f38f2ff902 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 11:06:35 +0000 Subject: [PATCH 2/3] fix(deno): remove deprecated --unstable-broadcast-channel and --unstable-byonm flags BroadcastChannel was stabilized in Deno 2.6.0, making --unstable-broadcast-channel unnecessary. --unstable-byonm is also deprecated as BYONM is now the default in Deno 2.x. Co-authored-by: pubkey <8926560+pubkey@users.noreply.github.com> --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3f9c7d7bd06..9e4d350ce52 100644 --- a/package.json +++ b/package.json @@ -435,10 +435,10 @@ "test:node:dexie": "npm run transpile && cross-env DEFAULT_STORAGE=dexie mocha --expose-gc --config ./config/.mocharc.cjs ./test_tmp/unit.test.js", "test:bun:dexie": "npm run transpile && cross-env DEFAULT_STORAGE=dexie NODE_ENV=fast bun run ./node_modules/mocha/bin/mocha test_tmp/unit.test.js --bail --timeout 60000", "test:bun:memory": "npm run transpile && cross-env DEFAULT_STORAGE=memory NODE_ENV=fast bun run ./node_modules/mocha/bin/mocha test_tmp/unit.test.js --bail --timeout 60000", - "test:deno:dexie": "npm run transpile && cross-env DEFAULT_STORAGE=dexie deno run --unstable-broadcast-channel --unstable-byonm --import-map=config/deno-import-map.json -A npm:mocha ./test/unit.test.ts --bail", - "test:deno:denokv": "npm run transpile && cross-env DEFAULT_STORAGE=denokv deno run --unstable-kv --unstable-broadcast-channel --unstable-byonm --import-map=config/deno-import-map.json -A npm:mocha ./test/unit.test.ts --bail --timeout 150000", + "test:deno:dexie": "npm run transpile && cross-env DEFAULT_STORAGE=dexie deno run --import-map=config/deno-import-map.json -A npm:mocha ./test/unit.test.ts --bail", + "test:deno:denokv": "npm run transpile && cross-env DEFAULT_STORAGE=denokv deno run --unstable-kv --import-map=config/deno-import-map.json -A npm:mocha ./test/unit.test.ts --bail --timeout 150000", "test:deno:denokv:loop": "npm run test:deno:denokv && npm run test:deno:denokv:loop", - "test:deno:memory": "npm run transpile && cross-env DEFAULT_STORAGE=memory deno run --unstable-broadcast-channel --unstable-byonm --import-map=config/deno-import-map.json -A npm:mocha ./test/unit.test.ts --bail", + "test:deno:memory": "npm run transpile && cross-env DEFAULT_STORAGE=memory deno run --import-map=config/deno-import-map.json -A npm:mocha ./test/unit.test.ts --bail", "test:node:foundationdb": "npm run transpile && cross-env DEFAULT_STORAGE=foundationdb mocha --expose-gc --config ./config/.mocharc.cjs ./test_tmp/unit.test.js", "test:node:mongodb": "npm run transpile && cross-env DEFAULT_STORAGE=mongodb mocha --expose-gc --config ./config/.mocharc.cjs ./test_tmp/unit.test.js", "test:node:mongodb:loop": "npm run test:node:mongodb && npm run test:node:mongodb:loop", From 557a50d4c5efa011708a9061cdc3f5f41901b928 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Jun 2026 12:14:49 +0000 Subject: [PATCH 3/3] fix(local-documents): fall back to storage check in upsertLocal when cache is evicted by GC Co-authored-by: pubkey <8926560+pubkey@users.noreply.github.com> --- .../fix-upsert-local-cache-eviction.md | 1 + src/plugins/local-documents/local-documents.ts | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 orga/changelog/fix-upsert-local-cache-eviction.md diff --git a/orga/changelog/fix-upsert-local-cache-eviction.md b/orga/changelog/fix-upsert-local-cache-eviction.md new file mode 100644 index 00000000000..4f8762652be --- /dev/null +++ b/orga/changelog/fix-upsert-local-cache-eviction.md @@ -0,0 +1 @@ +- FIX `upsertLocal()` would fail with a 409 conflict when the document existed in storage but had been evicted from the doc cache by the garbage collector. Now it falls back to a storage check before inserting. See https://github.com/pubkey/rxdb/pull/8531 diff --git a/src/plugins/local-documents/local-documents.ts b/src/plugins/local-documents/local-documents.ts index d7b123911f1..3c4b23c7477 100644 --- a/src/plugins/local-documents/local-documents.ts +++ b/src/plugins/local-documents/local-documents.ts @@ -69,8 +69,22 @@ export async function upsertLocal = any, Rea const docDataFromCache = state.docCache.getLatestDocumentDataIfExists(id); if (!docDataFromCache) { - // create new one - return this.insertLocal(id, data); + /** + * Not in cache - the document may still exist in storage but have been + * evicted from the cache by the garbage collector (FinalizationRegistry). + * Check storage before deciding to insert. + */ + const docFromStorage = await getSingleDocument(state.storageInstance, id); + if (!docFromStorage || docFromStorage._deleted) { + // create new one + return this.insertLocal(id, data); + } else { + // exists in storage but was evicted from cache - update it + const existing = state.docCache.getCachedRxDocument(docFromStorage) as any; + return existing.incrementalModify(() => { + return data; + }); + } } else if (docDataFromCache._deleted) { // document was deleted before, un-delete it via the write queue const writeResult = await state.incrementalWriteQueue.addWrite(