Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support interval fetch #64

Open
devtyty opened this issue Mar 18, 2024 · 2 comments
Open

Support interval fetch #64

devtyty opened this issue Mar 18, 2024 · 2 comments

Comments

@devtyty
Copy link

devtyty commented Mar 18, 2024

Can you add more interval fetch for query?

@k-ode
Copy link
Contributor

k-ode commented Mar 24, 2024

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]);

@devtyty
Copy link
Author

devtyty commented Mar 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants