fix: emit hydration comments for bindings when state is missing#71
Merged
Conversation
Previously, process_signal and process_for_loop in webui-handler only signal value or collection was found in state. If the value was missing, the markers were silently skipped, leaving the client-side hydration framework unable to locate and bind to those DOM positions. This was inconsistent with process_if, which always emits markers regardless of whether the condition references missing values. The fix moves on_binding_start/on_binding_end calls outside the value resolution check in process_signal, and replaces the early return in process_for_loop with an empty Vec so markers are still written around zero iterations.
akroshg
reviewed
Mar 6, 2026
|
|
||
| #[test] | ||
| fn test_hydration_missing_signal_still_emits_markers() { | ||
| let mut fragments = HashMap::new(); |
Contributor
There was a problem hiding this comment.
Since I am not yet developed skill to understand this test - would it be better if the test has big giant comment explaining on what it is doing?
Contributor
Author
There was a problem hiding this comment.
AI can figure out the test contents easily, but isn't the name good? testing if hydration emits markers for missing signals
Verify that hydration comment markers are emitted when a signal value is an empty string or a for-loop collection is an empty array. These complement the missing-state tests and ensure markers are present for all empty-value edge cases, not just null/missing ones. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
akroshg
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
process_signalandprocess_for_loopin webui-handler only signal value or collection was found in state. If the value was missing, the markers were silently skipped, leaving the client-side hydration framework unable to locate and bind to those DOM positions.This was inconsistent with
process_if, which always emits markers regardless of whether the condition references missing values.The fix moves
on_binding_start/on_binding_endcalls outside the value resolution check inprocess_signal, and replaces the early return inprocess_for_loopwith an empty Vec so markers are still written around zero iterations.