Apollo - Using optimisticResponse for dates

129 Views Asked by At

I'm trying to setup an optimisticResponse with a date column using react-apollo. My code is not properly returning the optimistic response data and rerendering my component accordingly. I'm assuming it's because I don't have the exact date that's being returned from my database.

Example object from mutation:

optimisticResponse: {
  postMessage: {
     id: -1,
     message,
     createdAt: moment().toISOString(),
     __typename: "Message",
  }
}

I'm using a pg database and autogenerating dates when my row is created ie.: ("2019-03-23T21:33:54.079Z"). I couldn't find any related issues and I'm at a loss for how to get around this.

0

There are 0 best solutions below