-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/* @once */
seems to work only for first child of object
#252
Comments
Yeah style and classList are special in that they analyze on a per object expression level. So in this case put the once in front of each property. <div style={ { width: /* @once */props.width, height: /* @once */props.height }} /> I realize there is nothing stopping us from oncing the whole object as well. |
The current behavior is particularly surprising when <div style={/* @once */ props.style} /> Currently In any case, I've added some documentation about the current behavior so this is less surprising. |
I was just looking how to fix this, the logic seems to be here https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions/src/shared/utils.js#L87-L94 |
Yeah I have to admit when I added these features they were compiler only originally. There has been talk about just deprecating |
I heard the expectation is to use a memo instead, is there other approach? Looks to me a bit of a waste, as there's going to be an effect created that is not going to be used, code would be bigger. For the case in place, can you consider merging it regardless of the future of this feature, it makes it work closer to the intention and of what's expected. |
see also solidjs/solid#1938 |
Say we have
generated code is
Playground: https://playground.solidjs.com/anonymous/03735897-b261-4420-835c-7e69c27ad978
The text was updated successfully, but these errors were encountered: