Skip to content

fix(core): compare numeric strings in visibility gt/lt - #349

Open
kevin9327 wants to merge 1 commit into
vercel-labs:mainfrom
kevin9327:fix/visibility-numeric-strings
Open

kevin9327 wants to merge 1 commit into
vercel-labs:mainfrom
kevin9327:fix/visibility-numeric-strings

Conversation

@kevin9327

Copy link
Copy Markdown
Contributor

Summary

Visibility gt / gte / lt / lte required both sides to be typeof number. YAML-quoted and LLM-generated state values are often strings, so { "$state": "/count", "gt": 3 } hid the element when count was "5".

Coerce numeric strings the same way lessThan / greaterThan validation already does. Empty strings, "10px", and booleans still fail the comparison.

Testing

  • pnpm exec vitest run packages/core/src/visibility.test.ts
  • pnpm test (1215 passed)

AI-assisted (Grok)

gt/gte/lt/lte required both sides to be typeof number. YAML-quoted
and LLM-generated counts are strings, so a gt: 3 condition hid the
element when count was "5". Coerce numeric strings the same way
lessThan/greaterThan validation already does. Empty and non-numeric
strings still fail the comparison.
@vercel

vercel Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

@kevin9327 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant