Skip to content

Difference between focusThrottleInterval and dedupingInterval #1699

Answered by shuding
b2m9 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey! Since SWR has focus revalidation enabled by default, focusThrottleInterval is to prevent doing a lot of revalidations if the window is getting and losing focus too frequently. So basically it means "do focus revalidation, but don't do it again during the focusThrottleInterval timespan".

And dedupingInterval is more general and it's the deduplication duration for more things, including focus revalidations. For example this is controlled by dedupingInterval:

const [show, setShow] = useState(false)

return <>
  {show ? <Foo/> : null}
  <button onClick={() => setShow(!show)}>toggle</button>
</>

Say if you have a SWR hook inside <Foo>, when clicking the toggle button, it will be mounted s…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@trainoasis
Comment options

@webMasterMrBin
Comment options

Answer selected by b2m9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants