Skip to content

<Dynamic> element registers reactivity in ref callback, may cause unexpected tracking and re-renders. #1147

@LiQuidProQuo

Description

@LiQuidProQuo

Describe the bug

Reactivity is tracked on the ref callback of <Dynamic> element.
The element re-renders, when signal count() changes.

function functionWithReactiveSideEffects(){
   count() // read signal
}
<Dynamic component="h3" ref={functionWithReactiveSideEffects}></Dynamic>

A regular element does not re render when count() changes

<h3 ref={functionWithReactiveSideEffects}></h3>

Your Example Website or App

https://playground.solidjs.com/?hash=1870300497&version=1.4.1

Steps to Reproduce the Bug or Issue

see repro

Element case

"reRender A" will only show once

dynamic element case

"reRender B" will show multiple times

Expected behavior

Dynamic element and a Element, should behave the same?

Screenshots or Videos

No response

Platform

playground

Additional context

discussion: https://discord.com/channels/722131463138705510/1005916405096529980
reported: greencactus

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions