Skip to content

Conversation

@titoBouzout
Copy link
Contributor

@titoBouzout titoBouzout commented Jul 12, 2025

Wanted to add ref as array, but noticed I could just add a ref: namespace and leave everything as is (from the perspective of the compiled code, it doesnt have to deal with arrays).

Currently, given how dom-expressions inline code the following just works (albeit is not obvious that it does):

<div ref={(el)=>el} ref={(el)=>el}/>

The problem is with Dynamic, this won't work:

<Dynamic component="div" ref={(el)=>el} ref={(el)=>el}/>

as compiles to:

  return _$createComponent(Dynamic, {
    component: "div",
    ref: el => el,
    ref: el => el
  });

But with the new namespace should work.

Notes:

  • needs docs
  • for whatever reason the refs are created in reverse order, I'm sure someone will notice at some point

Related to

/cc @edemaine

@ryansolid
Copy link
Owner

Yeah this is worth considering. Definitely want to have a decision on this in 2.0. Could add this sooner though without a ton of impact I think.

@titoBouzout titoBouzout changed the title adds ref: namespace [main] adds ref: namespace Nov 3, 2025
@titoBouzout
Copy link
Contributor Author

titoBouzout commented Nov 10, 2025

For the record:

This has been discussed here
https://discord.com/channels/722131463138705510/1435384712443990096

And somewhat the agreement is around here (to do something else)
https://discord.com/channels/722131463138705510/1435384712443990096/1437131440482554027

PR is WIP #475

https://discord.com/invite/solidjs invitation if you need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants