-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
When the wrapConditionals option is active, props cannot be read from outside of owners #2626
Copy link
Copy link
Open
Description
Describe the bug
In the attached playground, due to the wrapConditionals compiler option, this expression
wrap() ? n() * 2 : n()Gets turned into
_$memo(() => !!wrap())() ? n() * 2 : n()Which means that if the prop is read from outside an owner, that memo will never be disposed
Your Example Website or App
https://playground.solidjs.com/anonymous/453940c4-6eca-4afd-9f30-00dd75aab1cb
Steps to Reproduce the Bug or Issue
- Open the playground
- Press "Increase"
- (In the console, notice that the memo has a parent owner)
- Press the second button
- (In the console, notice that the memo has NOT a parent owner)
Expected behavior
The memo should not be created if there's no owner.
Maybe a special version of createMemo() (That just calls the function when there's no owner) should be used
Screenshots or Videos
No response
Platform
- OS: Windows
- Browser: Chromium Edge
- Version: 146.0.3856.59
Additional context
I used the console.log() to detect whether the memo had a parent owner because I don't know how to turn warnings on the playground
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels