Skip to content

fix(runtime): use strict comparison when updating properties#6573

Merged
johnjenkins merged 2 commits intostenciljs:mainfrom
SaiGovardhana:fix/set_accessor_strict_check
Jan 27, 2026
Merged

fix(runtime): use strict comparison when updating properties#6573
johnjenkins merged 2 commits intostenciljs:mainfrom
SaiGovardhana:fix/set_accessor_strict_check

Conversation

@SaiGovardhana
Copy link
Contributor

@SaiGovardhana SaiGovardhana commented Jan 27, 2026

What is the current behavior?

Currently, when component properties are updated, the runtime may treat distinct falsy values (like 0 and '') as equivalent due to loose equality checks. This can result in the DOM not reflecting the latest state, causing inputs or other properties to remain out of sync.

GitHub Issue Number: #6572

What is the new behavior?

Closes #6572

This PR introduces a strict comparison (!==) when updating element properties in the setAccessor function. Now, all value changes, including transitions between distinct falsy values, are properly propagated to the DOM.

Documentation

Does this introduce a breaking change?

  • Yes
  • No (Most Likely)

Testing

Added a unit test for the numeric input wrapper to verify that the internal correctly updates when the component property changes between distinct falsy values (e.g., 0 -> "").

Verified that the DOM value always reflects the latest property, ensuring transitions between falsy states are handled correctly.

@SaiGovardhana SaiGovardhana requested a review from a team as a code owner January 27, 2026 21:33
@johnjenkins
Copy link
Contributor

hey @SaiGovardhana - thanks for raising!
This change will cause extra renders for '', null and undefined.

I'm not sure if that's ok(?)

@SaiGovardhana
Copy link
Contributor Author

hey @SaiGovardhana - thanks for raising! This change will cause extra renders for '', null and undefined.

I'm not sure if that's ok(?)

Hi @johnjenkins , Are you talking about stencil web components being re-rendered?

  • I believe this branch of code is only run for standard html elements.

  • Also the value stored set to element would be an empty string for null and undefined

@johnjenkins johnjenkins added this pull request to the merge queue Jan 27, 2026
Merged via the queue into stenciljs:main with commit e8dfc09 Jan 27, 2026
69 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.

bug: Incorrect value update when switching falsy values for a prop typed as any.

2 participants