twenty
twenty copied to clipboard
add optimistic responses on mutations
This PR
- Adds optimistic responses on Mutations
- Related to #5676
Note to @FelixMalfait
The initial scope of the issue was to apply optimistic rendering on queries, but it seems like Apollo Client only supports it on Mutations (https://www.apollographql.com/docs/react/performance/optimistic-ui/).
This PR doesn't really improve the time it takes to resolve the mutation due to the queries in the refetchQueries
array
No matter how fast the mutation becomes, it still needs to re-fetch some queries(which makes 100% sense, leading to some limitations on the client side to improve the API call)
Unfortunately, queries seems to be the ones delaying our API calls (see image below), maybe addressing the performance on those queries, server-side would make more sense
@FelixMalfait please have a look and tell me if I missed something