← Back to PRs

#3978: refactor: changing nested ternaries to a switch statement

by watercubz open 2026-01-29 13:15 View on GitHub →
scripts
## Summary The nested ternary in `ui.js` was modified to use a switch statement for a cleaner, simpler, and easier-to-maintain solution. ## Changes The nested ternary statements were replaced with a switch statement, which reduces nesting and is easier to maintain. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Replaced a nested ternary used to select the UI `pnpm run` script with a `switch` statement in `scripts/ui.js`, aiming to make the action-to-script mapping easier to read and extend. The rest of the script still resolves a pnpm runner, ensures UI deps are installed, and then runs `pnpm install` or `pnpm run <script>` from the `ui/` directory. <h3>Confidence Score: 3/5</h3> - This PR is mostly safe to merge, with one small behavior change worth addressing. - The change is localized to `scripts/ui.js` and primarily refactors control flow, but it changes the `install` case from `script=null` to `script="install"`, which could cause subtle issues if future code relies on `script` for the install path. Formatting inconsistencies are minor but may trip lint/format checks depending on repo configuration. - scripts/ui.js <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs