How to prevent fetching data by using isDataEqual
?
#1601
Replies: 1 comment
-
you usually don't need to care about what you are seeing is most likely 2 re-renders because This flag is exposed so that you can show a background loading spinner if you want. For render optimisations, you can use if you are only interested in e.g.
if you want to exclude
should this PR land, we'll also have automatic tracking to only re-render if a prop you are actually using has changed. Generally, I wouldn't worry about "unnecessary re-renders". As long as they are fast, it really doesn't matter. If your form takes too long to render, try not to minimize the re-renders (that's an uphill battle imo) - try to make the render fast again :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @tannerlinsley and all maintainers!
After I read the docs I found
isDataEqual
option to handle oldData and newData but I'm still confused how doesisDataEqual
work?Maybe I miss some information about it. I assume about
isDataEqual
that the staledata
will be returned ifoldData === newData
. or maybe I was wrong?My workaround
I simulate, I'm out of browser and come back to the browser and what I get is re-render, even tho I'm using
isDataEqual
.I thought by using
isDataEqual
will avoid spurious re-renders. or maybe I was also wrong doing my workaround and should I userefetchOnWindowFocus
?Beta Was this translation helpful? Give feedback.
All reactions