fix(pipeline): evaluate chained || in template engine#305
Open
Astro-Han wants to merge 2 commits intojackwener:mainfrom
Open
fix(pipeline): evaluate chained || in template engine#305Astro-Han wants to merge 2 commits intojackwener:mainfrom
Astro-Han wants to merge 2 commits intojackwener:mainfrom
Conversation
- isNaN → Number.isNaN (2 occurrences) - string concatenation → template literal - biome-ignore for intentional control chars in sanitize regex
The || handler in evalExpr returned the right side as a literal string instead of recursively evaluating it. This broke chained fallbacks like `item.a || item.b || 'default'` — when item.a was falsy, the entire `item.b || 'default'` was returned as text. Fix: call evalExpr on the right side so chained || works at any depth.
Contributor
Author
|
The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
||handler inevalExpr(src/pipeline/template.ts) only evaluated the left side recursively. When the left side was falsy, the right side was returned as a literal string instead of being recursively evaluated.Single
||worked:Chained
||broke:Fix: call
evalExpr()on the right side so chained||evaluates at any depth.Closes #303
Type of Change
Checklist
Changes
Commit 1:
chore: fix pre-existing biome lint in template.tsUnrelated to the bug — biome hook blocks commits on any file with lint errors, so these pre-existing issues had to be fixed first:
isNaN→Number.isNaN(2 occurrences)biome-ignorefor intentional control chars in sanitize regexCommit 2:
fix(pipeline): evaluate chained || in template engineCore fix (1 line): change the
||handler's right-side from literal string return to recursiveevalExpr()call.Tests (7 new cases):
Screenshots / Output