Skip to content

Commit

Permalink
fix: mutate ignore processing null read/writes
Browse files Browse the repository at this point in the history
  • Loading branch information
puppybits committed Dec 14, 2021
1 parent 91f3fb9 commit 42ba437
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/mutate.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ async function writeInTransaction(firebase, operations) {

const done = mark('mutate.writeInTransaction:reads');
const readsPromised = mapValues(operations.reads, async (read) => {
if (!read) return read;

if (isProviderRead(read)) return read();

if (isDocRead(read)) {
Expand All @@ -199,14 +201,15 @@ async function writeInTransaction(firebase, operations) {
const writes = [];

operations.writes.forEach((writeFnc) => {
if (!writeFnc) return;
const complete = mark('mutate.writeInTransaction:writes');
const operation =
typeof writeFnc === 'function' ? writeFnc(reads) : writeFnc;

if (Array.isArray(operation)) {
operation.map((op) => write(firebase, op, transaction));
writes.push(operation);
} else {
} else if (operation) {
writes.push(write(firebase, operation, transaction));
}

Expand Down

0 comments on commit 42ba437

Please sign in to comment.