Skip to content

fix(ssr): translate initial_value/checked/selected to HTML equivalents#5493

Merged
ealmloff merged 2 commits into
DioxusLabs:mainfrom
costajohnt:fix/ssr-initial-value-attribute
Jul 1, 2026
Merged

fix(ssr): translate initial_value/checked/selected to HTML equivalents#5493
ealmloff merged 2 commits into
DioxusLabs:mainfrom
costajohnt:fix/ssr-initial-value-attribute

Conversation

@costajohnt

Copy link
Copy Markdown
Contributor

Summary

  • Add ssr_attr_name() translation for virtual attributes (initial_value, initial_checked, initial_selected) to their HTML equivalents (value, checked, selected)
  • Apply translation in both static (cache.rs) and dynamic (renderer.rs) SSR paths

Why

The SSR renderer writes virtual attributes like initial_value literally into the HTML output (producing <input initial_value="hello">) instead of translating them to standard HTML attributes (<input value="hello">). The client-side interpreter (set_attribute.ts) already handles this mapping correctly, but the SSR path was missing it.

Verification

  • 4 new tests covering initial_value, initial_checked, initial_selected (static + dynamic)
  • All 21 SSR tests pass (4 new + 17 existing)
  • cargo check -p dioxus-ssr clean

Fixes #5491

@costajohnt costajohnt requested a review from a team as a code owner April 16, 2026 01:13
Comment thread packages/ssr/tests/initial_value.rs
The SSR renderer wrote virtual attributes like `initial_value`
literally into the HTML output instead of translating them to
their HTML equivalents (`value`, `checked`, `selected`).

Add an `ssr_attr_name` translation function that maps these
Dioxus-specific props to standard HTML attributes, matching
what the client-side interpreter already does in set_attribute.ts.

Fixes DioxusLabs#5491
Collapse short assert_eq to single line per rustfmt, and remove
needless borrows flagged by clippy::needless_borrow.
@costajohnt costajohnt force-pushed the fix/ssr-initial-value-attribute branch from 9d0741c to 3053e01 Compare April 24, 2026 16:13
@costajohnt

Copy link
Copy Markdown
Contributor Author

Just a friendly ping on this one. CI is green and the change should be ready for a maintainer to take a look when there's bandwidth.

@costajohnt

Copy link
Copy Markdown
Contributor Author

Checking back in on this SSR fix. Understand if things have been busy, just let me know if it's still on the table or if I should close it.

@ealmloff ealmloff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ealmloff ealmloff merged commit 2d547c5 into DioxusLabs:main Jul 1, 2026
21 checks passed
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.

initial_value sets initial_value attribute

3 participants