<video> tag flashes when using react query
Hi all, I'm using react query to manage my browser based video editor's asset library:
Since the files are hosted in a private Cloudflare R2 bucket, I need to get presigned URLs to access them so I set up this query to do so. However whenever the page loads, it shows the initial content (thanks to SSR from NextJS) and then flashes once react query revalidates.
I checked both JSON objects, they're the exact same. Why would it cause a re-render?
12 Replies
xenial-blackOP•3y ago
xenial-blackOP•3y ago
fascinating-indigo•3y ago
make sure that when you map over your assets that they have a key, this isn't a react-query issue but an issue with how react handles re-renders
and mapping over items
xenial-blackOP•3y ago
that's why I'm confused
xenial-blackOP•3y ago


xenial-blackOP•3y ago
i have keys on everything that's mapped
fascinating-indigo•3y ago
If you've got the react devtools browser extension you can probably see what's causing a re-render
xenial-blackOP•3y ago
is there a way to see what causes renders?
fascinating-indigo•3y ago
using the extension
xenial-blackOP•3y ago
I have it
constant-blue•3y ago
react-query refetches on the client with default staleTime of zero
xenial-blackOP•3y ago
that makes sense, I ended up setting it to Infinity for now, although I would really like to find a way to have react query refetch and update the <video> tags without having that flash of content, but that's not a tanstack issue