Skip to content

Avoid recreating entire page between nested routes #2579

Closed Answered by shivjm
shivjm asked this question in Q&A
Discussion options

You must be logged in to vote

As I put together an MWE, I discovered that the problem was is_account_page():

<ul class="accounts" class=("accounts--collapsed", is_account_page())>

I changed it to is_account_page, thereby using the reactive version, to fix it. I was confused, though. Since is_account_page() is a static value, my code should never have worked at all. @gbj explained that it’s actually the Await that’s being re-rendered:

But the signal is still being read inside a function being passed into the view (https://docs.rs/leptos/latest/src/leptos/await_.rs.html#119)

So when that one signal changes, it causes the whole body of the Await to be rerendered

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by shivjm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant