Skip to content

Fix classNames runtime helper for undefined and unmapped classes#335

Merged
dfreeman merged 4 commits intosalsify:standalone-template-transformfrom
deanmarano:standalone-template-transform
Feb 20, 2026
Merged

Fix classNames runtime helper for undefined and unmapped classes#335
dfreeman merged 4 commits intosalsify:standalone-template-transformfrom
deanmarano:standalone-template-transform

Conversation

@deanmarano
Copy link
Contributor

Summary

  • Guard against undefined/null/empty string being passed to classNames() in the runtime helper — previously threw TypeError: Cannot read properties of undefined (reading 'trim')
  • Drop unmapped class names instead of passing them through — the ?? fallback in classNames() was passing unknown classes (e.g. global utility classes like .is-hidden) to the DOM, which changed behavior from v2 where they were silently dropped. This caused issues like CSS transitions breaking when global display: none classes were unexpectedly applied.

Test plan

See also: #318

@dfreeman dfreeman merged commit 5585991 into salsify:standalone-template-transform Feb 20, 2026
2 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.

2 participants