Closed ReidyT closed 1 week ago
To solve this issue, I used the keepPreviousState
function in the placeholder
. This avoids the unwanted re-render with undefined value when fetching new data.
There is still a small issue on very small network, we have to check if it's acceptable or not.
https://github.com/user-attachments/assets/d14b121d-a2e0-4079-bec3-6124e4b912ac
Thanks to @spaenleh, the simplest way to fix this issue, is to derivate the focusedItem
from the itemsToShow
.
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
42.9% Duplication on New Code
Since the Query v5 doesn't fill the cache from
descendants
and other queries, theuseItem
is empty on first render, potentially causing a re-render of the three.https://github.com/user-attachments/assets/697b53dc-35cc-490e-b9bf-eb8f444d0ee5
https://github.com/user-attachments/assets/9f911b5e-0dbd-42b8-87ae-2f5ed39d9693
https://github.com/user-attachments/assets/f18e5ac8-3b30-4f44-a3de-8d6673b27aa5
Indeed, this re-render is removed when setting the following
placeholder
for theuseItem
:The problem is we cannot always get the item's data from another cache because it depend on the view (sometimes from descendants, children, etc and the filters aren't always the same). Moreover, it's not possible to retrieve the parent id only from the given item's id and the cache.