Replies: 1 comment
-
SWR only causes re-renders if the data has changed. It uses deep comparison here so if the video component is re-rendered or re-mounted, it's probably because one of these:
Maybe try to debug what & why a component rerendered. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a section on my website that displays a video. The video is sourced from a cloudfront URL that requires signing and has an expiration time set. Currently, I'm using the
useSwr
hook to fetch and handle this data, which is functioning well. However, I have a few concerns.Firstly, if I start playing the video and then navigate to another tab, when I return to the page, the data is re-validated, causing the video to restart from the beginning. To address this issue, I've set
revalidateOnFocus
to false. However, this is not an ideal solution as the page may update occasionally. I'm interested to know if there are any alternative approaches to handle this situation. For example, perhaps only revalidating on focus when the video has expired?Beta Was this translation helpful? Give feedback.
All reactions