Skip to content

Unexpected memo wrap (optimization?) causes a computation to be created outside of createRoot #2479

Open
@deluksic

Description

@deluksic

Describe the bug

https://playground.solidjs.com/anonymous/353e9151-5770-4d67-a3a1-5fa598920e7b

Unfortunately, the playground is not really showing the problem because it uses production solid, I think. But in the output tab you can see the _$memo being applied, presumably as an optimization. However, this causes a problem when such prop is used outside of roots, in events etc.

It is not reproducible in playground, but this is what I see locally:

Image

Your Example Website or App

https://playground.solidjs.com/anonymous/353e9151-5770-4d67-a3a1-5fa598920e7b (Edit to fix a typo)

Steps to Reproduce the Bug or Issue

  1. Go to output tab
  2. Notice the added _$memo

Expected behavior

I would expect I can just use props. in events as a normal read.

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

Easy workaround is to extract the expression into a lambda above the return statement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions