fix: Ignore undefined and null style values by jmvaldez · Pull Request #833 · vercel/satori · GitHub
Skip to content

fix: Ignore undefined and null style values - #833

Open
jmvaldez wants to merge 1 commit into
vercel:mainfrom
jmvaldez:fix/undefined-style-values
Open

jmvaldez wants to merge 1 commit into
vercel:mainfrom
jmvaldez:fix/undefined-style-values

Conversation

@jmvaldez

@jmvaldez jmvaldez commented Oct 3, 2026

Copy link
Copy Markdown

Fixes #831.

A style value set to undefined threw Cannot read properties of undefined (reading 'trim'), and null was turned into 0 (so fontSize: null hid the text). With tw, an undefined key also overwrote the Tailwind value.

This drops undefined/null entries from style in layout.ts before the tw merge, so they behave like an unset property, same as React.

Tests in test/nullish-style.test.tsx compare against the render with the key omitted.

@jmvaldez
jmvaldez requested a review from shuding as a code owner October 3, 2026 00:39
@vercel

vercel Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
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.

Style values set to undefined throw "Cannot read properties of undefined (reading 'trim')"

1 participant