mst-query icon indicating copy to clipboard operation
mst-query copied to clipboard

Support interval fetch

Open devtyty opened this issue 3 months ago • 2 comments

Can you add more interval fetch for query?

devtyty avatar Mar 18 '24 06:03 devtyty

I'd like to add this eventually, but in the meantime you can get the same thing with useEffect:

const { query } = useEffect(store.query);

useEffect(() => {
   const id = setInterval(() => {
       query.invalidate()
   }, 5000);
   return () => {
       clearInterval(id);
   }:
}, [query]);

k-ode avatar Mar 24 '24 19:03 k-ode

I'd like to add this eventually, but in the meantime you can get the same thing with useEffect:

const { query } = useEffect(store.query);

useEffect(() => {
   const id = setInterval(() => {
       query.invalidate()
   }, 5000);
   return () => {
       clearInterval(id);
   }:
}, [query]);

Yah! me too. But i think own lib should support for this to avoid boilerplate code

devtyty avatar Mar 26 '24 04:03 devtyty