Open VarPDev opened 10 months ago
@VarPDev can you make a minimal repro in https://qwik.builder.io/playground?
@wmertens
I can't use the playground well. You can clone the repository I linked though, run npm i
and npm run dev
. You can find the code on the "layout.tsx" page.
It's a simple site, nothing complex
Yes is a cute cat ahah
The console.log, was not triggered again, but the html was rerender. If you can add tailwind in playgroud, add this button
<Link href="/" target="_blank">
<button class="btn btn-primary text-black">Text button</button>
</Link>
in Hello component and when the cat disappears, you can see the button have a entry animation again
@VarPDev on my phone but you can add TW by including the CDN css link in the root.tsx tab
Ok here's a simpler playground with the problem. The animation on Hello should only happen on initial render, but instead it happens every time you click Toggle to make the before and after disappear.
When you "inspect element" on Hello and toggle the button, you'll see the before and after components appear and disappear, but you'll also see that the Hello div
flashes as being re-rendered. The component itself doesn't re-render but the browser does re-render the contents. (In your example site you can see that then entire page re-renders like this).
This doesn't happen the element before or after is a string (try it by selecting the entire <p>...</p>
and quoting it), only if they both are elements.
Furthermore, when I do "store as global variable" on the Hello div and toggle and then store again, these two global variables are in fact the same.
Finally, the Render Stats say that 3 operations are being made and none of them touches the Hello component, so I don't understand why the browser thinks it's changing. When I manually call insertBefore()
or remove()
, it doesn't show the Hello element as changing.
Paging @mhevery, it looks like there is a bug with applying operations in this particular case?
@wmertens
The mutation of the child list can trigger the rerendering.
Changed the forward <p>
element to be kept, then the rerendering is not happened.
Which component is affected?
Qwik Runtime
Describe the bug
By placing a component inside the layout.tsx file after the slot, visible via a signal value a rerender of the entire slot takes place
You can play it back by clicking on the switch at the top right of the header. Once the kitten appears click again to make it disappear and you will notice that the get resume button, in the hero section, will do the entry animation, this means that the component has been reloaded.
layout.tsx code below:
if you move
{show.value && <CatWalk />}
before the slot, it don't reloadThe full repo: https://github.com/VarPDev/pako
Reproduction
https://pako-git-ssr-varpdev.vercel.app/?_vercel_share=DU0WyukXXApiQswlWQPBtLb2pXz3168A
Steps to reproduce
No response
System Info
Additional Information
No response