Skip to content

Commit

Permalink
fix: server timestamp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
puppybits committed Dec 2, 2021
1 parent 6a239bb commit 895525a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/reducers/cacheReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {
isEmpty,
identity,
} from 'lodash';
import { Timestamp } from 'firebase/firestore';
import { actionTypes } from '../constants';
import { getBaseQueryName } from '../utils/query';
import mark from '../utils/profiling';
import { getFirestore } from '../createFirestoreInstance';

const info = debug('rrf:cache');
const verbose = debug('rrfVerbose:cache');
Expand Down Expand Up @@ -508,7 +508,8 @@ const arrayRemove = (key, val, cached) =>
const increment = (key, val, cached) =>
key === '::increment' && typeof val === 'number' && (cached() || 0) + val;

const serverTimestamp = (key) => key === '::serverTimestamp' && Timestamp.now();
const serverTimestamp = (key) =>
key === '::serverTimestamp' && getFirestore().FieldValue.serverTimestamp();

/**
* Process Mutation to a vanilla JSON
Expand Down

0 comments on commit 895525a

Please sign in to comment.