Part 1 of #367.
Comparison operands (eq, neq, gt, gte, lt, lte) only resolved { "$state" }, so a custom directive was compared as a raw object. resolveComparisonValue now looks the operand up in the directive registry, the same way resolvePropValue does for props.
{ "visible": { "$state": "/limit", "lte": { "$count": { "$state": "/cart/items" } } } }- Works in element
visible(the React renderer already passes a context withdirectives) and inside$condin props. - Contexts without a registry behave as before.
- The
ComparisonOperatorstype and both visibility schemas accept a non-empty$-keyed object ongt/gte/lt/lte, so these specs also pass validation (thanks to the Vercel Agent review).
Tests: 5 new cases in directives.test.ts; the two directive cases fail without the change. vitest run packages/core and check-types pass (repeat-schema-parity.test.ts fails locally because it imports a built @json-render/core, unrelated to this change).
The left-hand side ({ "$count": ..., "gt": 0 } as a condition source) touches SingleCondition and its schema, so I'll send it as a separate PR.
Activity
5@harold18m is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.