Skip to content
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

Inconsistent Treatment of undefined in SSR #940

Closed
dairyisscary opened this issue Apr 18, 2022 · 0 comments
Closed

Inconsistent Treatment of undefined in SSR #940

dairyisscary opened this issue Apr 18, 2022 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@dairyisscary
Copy link

dairyisscary commented Apr 18, 2022

Describe the bug

Attributes with an undefined runtime value are treated differently in SSR than they are in client rendering. In client rendering, attributes are completely removed when the value is undefined but in SSR, sometimes the attribute is serialized with "" and sometimes its serialized as string "undefined".

In my particular example, I'm using aria-describedby, where a valid ID is required (and in my particular case, isn't known until the client hydrates so SSR without the attribute is desirable).

Your Example Website or App

https://playground.solidjs.com/?hash=-776479397&version=1.3.13

Steps to Reproduce the Bug or Issue

See example, I have static div, <Dynamic /> and a custom component using spread. Custom component and Dynamic seem to behave the same but I've included both just in case.

Expected behavior

I'm not sure what is correct behavior here, tbh. i definitely think string "undefined" is no good but because of how clever the compiler is at "precompiling" the static bits of the string (in this case the aria-describedby= part), I'm not sure "" is wrong. Though for this particular attribute, i think an HTML validator/spec checker will complain about the empty string.

Screenshots or Videos

No response

Platform

  • OS: mac, node v16
  • Browser: all
  • Version: 1.3.15

Additional context

No response

@ryansolid ryansolid added the bug Something isn't working label Apr 22, 2022
@ryansolid ryansolid added this to the 1.4.0 milestone Apr 22, 2022
ryansolid added a commit that referenced this issue May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants