solidjs / solid

A declarative, efficient, and flexible JavaScript library for building user interfaces.
https://solidjs.com
MIT License
31.64k stars 887 forks source link

[Bug] Repeated call syntax in JSX breaks reactivity #2134

Closed deluksic closed 2 months ago

deluksic commented 2 months ago

Describe the bug

Having someSignal()() inside JSX breaks reactivity.

Your Example Website or App

https://playground.solidjs.com/anonymous/a27d79e6-d87f-4361-ad2b-512cd32c6d18

Steps to Reproduce the Bug or Issue

  1. Click the first counter a few times to make it different than the second counter
  2. Toggle between the counters using the third button

Expected behavior

I expect Result (broken) to match Result (works).

Screenshots or Videos

No response

Platform

All

Additional context

Discussion on discord https://discord.com/channels/722131463138705510/751355413701591120/1229427809173377144

ryansolid commented 2 months ago

Yeah this is a compiler error.. when it detects it can avoid the wrapper and pass in the signal directly there is no new wrapper made. It turns out that we prematurely remove the wrapper when there are double function calls.