-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Describe the bug
Hello! I have three components: ComponentA and ComponentB get ComponentC via props. Depending on isMobile signal,ComponentC is rendered either under ComponentA or ComponentB. But sometimes ComponentC is not displayed in these components. Moreover, sometimes nothing is displayed. So I provided the link who you can reproduce the problem
Your Example Website or App
https://stackblitz.com/edit/solid-vite-h2s1pgwn
Steps to Reproduce the Bug or Issue
- Follow the link
- Resize the window to 400px to get
isMobile = true - Check the displaying of
ComponentC - Resize the window to more then 400px to get
isMobile = false - Check the displaying of
ComponentC
Expected behavior
On more then 400px I expected to see ComponentC under ComponentB - on desktop block
On less then 400px I expected to seeComponentC under ComponentA - on mobile block
But right now ComponentC is displayed unpredictable, sometimes under ComponentA, sometimes under ComponentB and sometimes nothing is displayed.
Screenshots or Videos
As you can see from the video, if you wrap ComponentC in a <div>, the content is displayed as expected, but I don't understand why it works this way? The fix with the <div> doesn't look obvious and I would like to better understand the process of rendering content inside the <Show>.
An additional question is that onMount is called inside ComponentC even when the component has not been rendered. I believe this is happening because of callingchildren(). So how do I make sure that onMount is not called until the component is displayed in the DOM?
Platform
- OS: macOS
- Browser: Chrome
- Version: 138.0.7204.184