nanostores / query

⚡️ Powerful data fetching library for Nano Stores. TS/JS. Framework agnostic.
MIT License
228 stars 10 forks source link

Warning when using a React component in an Astro project #49

Closed JacobZwang closed 3 months ago

JacobZwang commented 4 months ago

When using nanoquery in a react component in an astro project I get this warning in the console. I'm not familiar enough with react to completely understand this warning so I'm not sure if this is a problem or not.

Warning: The result of getServerSnapshot should be cached to avoid an infinite loop at NanoQueryExample (http://localhost:4322/src/components/nanoquery.tsx:31:29)

https://stackblitz.com/github/JacobZwang/nanoquery-astro-broken-example https://github.com/JacobZwang/nanoquery-astro-broken-example

sitarass commented 3 months ago

m2 in nextjs project

sitarass commented 3 months ago

@dkzlv check here the error

image
dkzlv commented 3 months ago

This is not a bug, just excessive logging by React.

Refer to this comment, header getSnapshot should be cached.