Skip to content

Commit 7902888

Browse files
authored
fix(store-sync): handle pending deletion in stash storage adapter (#3672)
1 parent fdb727e commit 7902888

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎.changeset/hot-bananas-invite.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/store-sync": patch
3+
---
4+
5+
Pending deletions immediately followed by field updates are now handled correctly by the Stash storage adapter.

‎packages/store-sync/src/stash/createStorageAdapter.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ export function createStorageAdapter({ stash }: CreateStorageAdapter): StorageAd
4646
updates.push((pendingRecords[id] = { table, key, value }));
4747
} else if (log.eventName === "Store_SpliceStaticData") {
4848
const previousValue = pendingRecords[id]
49-
? ({ ...pendingRecords[id].key, ...pendingRecords[id].value } as TableRecord)
49+
? pendingRecords[id].value
50+
? ({ ...pendingRecords[id].key, ...pendingRecords[id].value } as TableRecord)
51+
: undefined
5052
: getRecord({ stash, table, key });
5153

5254
const {

0 commit comments

Comments
 (0)