Skip to content

Don't mutate caller's props object in createElement#357

Open
brainkim wants to merge 1 commit into
mainfrom
fix/element-tweaks
Open

Don't mutate caller's props object in createElement#357
brainkim wants to merge 1 commit into
mainfrom
fix/element-tweaks

Conversation

@brainkim
Copy link
Copy Markdown
Member

@brainkim brainkim commented Apr 2, 2026

createElement was mutating the incoming props to assign children, which causes circular references when callers reuse the same props object across calls (e.g. vanity-h's proxy-based hyperscript DSL). Spread into a fresh object instead, only when children are present.

Also guard the key assignment in jsxAdapter behind a null check to avoid unconditionally adding key: undefined to every props object, which causes unnecessary hidden class transitions.

Fixes #356

createElement was mutating the incoming props to assign children, which
causes circular references when callers reuse the same props object
across calls (e.g. vanity-h's proxy-based hyperscript DSL). Spread into
a fresh object instead, only when children are present.

Also guard the key assignment in jsxAdapter behind a null check to avoid
unconditionally adding key: undefined to every props object, which
causes unnecessary hidden class transitions.

Fixes #356

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 when using Crank.js with vanity-h

1 participant