Skip to content

Fix reflection errors when explicitly “false”.#354

Merged
theengineear merged 1 commit intomainfrom
improve-reflection
Mar 11, 2026
Merged

Fix reflection errors when explicitly “false”.#354
theengineear merged 1 commit intomainfrom
improve-reflection

Conversation

@theengineear
Copy link
Copy Markdown
Collaborator

While developers will typically just omit the configuration for property reflection when anything other than “true” — it should still work when explicitly set to “false”.

The crux of the change is to delete the property entirely such that the truthy path ends up with a special function and the falsey path ends up with undefined (which is our expectation). Previously, when we saw the internal value was indeed defined — we expected to be able to call it as a function, which caused a failure.

Closes #353.

Comment thread x-element.js
hostInfo.reflecting = false;
};
} else {
delete property.reflect;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We explicitly delete now in the false case so that we can depend on this being either undefined or a Function in later code.

@klebba
Copy link
Copy Markdown
Contributor

klebba commented Mar 10, 2026

Thanks @theengineear — LG2M — much appreciated!

While developers will typically just _omit_ the configuration for
property reflection when anything other than “true” — it should still
_work_ when explicitly set to “false”.

The crux of the change is to `delete` the property entirely such that
the truthy path ends up with a special _function_ and the falsey path
ends up with `undefined` (which is our expectation). Previously, when
we saw the internal value was indeed _defined_ — we expected to be able
to call it as a function, which caused a failure.

Closes #353.
@theengineear theengineear merged commit 08b59df into main Mar 11, 2026
1 check passed
@theengineear theengineear deleted the improve-reflection branch March 11, 2026 05:02
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.

Property with reflect: false results in halting error

2 participants