ReviewOS
@if (!issue)

No such issue

stacks/stx has no issue numbered 2081.

@else

stacks/stx

a negated template guard fails open: :if="!blocked" renders when the identifier is missing

#2081
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Expression evaluation swallows every failure and yields undefined. For a positive condition that fails closed. For a negated one it fails open, and a negated condition is how most authorization guards in a template are written.

import { safeEvaluateCondition } from '@stacksjs/stx/safe-evaluator'

safeEvaluateCondition('blocked', {})         // false  <- correct
safeEvaluateCondition('!blocked', {})        // true   <- renders the guarded block
safeEvaluateCondition('!canEdit', {})        // true
safeEvaluateCondition('!isPaid && !isTrial', {})  // true

So