ConsoleTVs / sswr

🔥 Svelte stale while revalidate (SWR) data fetching strategy
MIT License
234 stars 11 forks source link

Dependent fetching doesn't revalidate when changing to an already cached value #43

Open marekdedic opened 1 year ago

marekdedic commented 1 year ago

Hi, I'm using dependent fetching and after #33 it works for me - sort of.

I have a SWR table with a filtering function - user enters a value into the field and with dependent fetching, the value is used as part of a request. While the request is in-flight a show a spinning loading indicator.

Initially, this works great:

  1. User enters/changes a value
  2. The SWR changes to undefined, I show the loading indicator
  3. A request is triggered
  4. When the request resolves, the SWR changes from undefined to the actual value and the table is shown.

However, when the user enters a value that he has already previously entered (so the request response is in SWR's cache), the following happens:

  1. User enters/changes a value
  2. The SWR changes to undefined, I show the loading indicator
  3. Nothing more - no request is fired (I use a long dedupingInterval), no value is returned.

I think this might actually be an issue with swrev?