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

LeptosQuery renders component N+1 times, where N is the number of LeptosQuery resources #35

Open
rconnol opened this issue Oct 10, 2024 · 2 comments

Comments

@rconnol
Copy link

rconnol commented Oct 10, 2024

Issue:
If I use multiple Leptos Queries, and match on the results, any component nested in the Suspense or Transition will get re-rendered N+1 times, where N is the number of Leptos Queries I am using.

I created an MRE:
https://github.com/rconnol/mre-multiple-resources

If you run this application:
cargo leptos serve

if you go to /correct which uses a traditional Leptos resource, it only renders once

image

@rconnol
Copy link
Author

rconnol commented Oct 10, 2024

I pushed a commit that adds a workaround at the path /workaround

My hunch is that it has to do with the scope of the match statement. If I remove the match and unwrap the data, then it only renders once.

@rconnol
Copy link
Author

rconnol commented Oct 11, 2024

and actually, the workaround is not a workaround

so I guess what I am really asking, is how are you supposed to effectively use multiple queries in the same component without re-rendering it multiple times?

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

1 participant