Skip to content

Commit

Permalink
Fix crud if prevAtPath undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeistrich committed Nov 10, 2024
1 parent 446e702 commit edecede
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sync-plugins/crud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ export function syncedCrud<TRemote extends object, TLocal = TRemote, TAsOption e

for (let i = 0; i < changed.length; i++) {
const [key, value] = changed[i];
const prev = asMap ? prevAtPath.get(key) : prevAtPath[key];
const prev = prevAtPath ? (asMap ? prevAtPath.get(key) : prevAtPath[key]) : undefined;
if (isNullOrUndefined(value) && !isNullOrUndefined(prev)) {
deletes.add(prev);
return false;
Expand Down

0 comments on commit edecede

Please sign in to comment.