does the optimistic updates gets batched?

if I make update call 3 times to a resource which is in optimistic updates mode, it should make actual api call only once
5 Replies
kapa.ai
kapa.ai5d ago
Hi @AK. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the provided knowledge sources, there isn't specific information about batching optimistic updates in refine. However, I can provide some relevant information about how optimistic updates work in refine: Refine supports optimistic updates as one of its mutation modes. In optimistic mode, the UI is updated immediately without waiting for the server response, giving users a snappier experience. According to the Mutation Modes documentation, when using optimistic mode: "The mutation is applied locally, redirection and UI updates are executed immediately as if the mutation is successful. If mutation returns with error, UI updates to show data prior to the mutation." However, the documentation doesn't mention batching multiple optimistic updates into a single API call. Each mutation appears to trigger its own API call, even in optimistic mode. If you need more precise control over how updates are batched or applied, you may want to consider customizing the optimistic update behavior using the optimisticUpdateMap prop, as described in the useUpdate hook documentation. To get a definitive answer about batching multiple optimistic updates, you may need to consult the refine documentation further or reach out to the refine community for clarification. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5d ago
<@1298702566271484007> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
flat-fuchsia
flat-fuchsia4d ago
Hello @AK , we need more information to debug this. Can you provide us reproducible example please?
absent-sapphire
absent-sapphireOP3d ago
Hey @Alican Erdurmaz , it;s more of a question. But I can create a example for this purpose.
flat-fuchsia
flat-fuchsia2d ago
I'm sorry, I misunderstood. unfortunately there is no such feature in Refine

Did you find this page helpful?