fix(frontend): prevent MultiSelect crash on undefined value#9364
Merged
rubenfiszel merged 1 commit intoMay 28, 2026
Merged
Conversation
MultiSelect read `value.length` directly while `value` is a bindable prop with no default, so a parent passing `undefined` (e.g. an enum-array approval form field with no initial value via ArgInput) threw a TypeError that blanked the entire approval page. Guard all reads behind a `value ?? []` derived. Fixes WIN-1996 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
The approval/resume page (e.g.
/approve/{workspace}/{job}?token=...) rendered completely blank for some flows. The production stack trace pointed tovalue.length === 0insideMultiSelect.svelte.Root cause:
valueis a$bindable()prop with no default, typedValue[], butArgInput.svelte:862,872renders<MultiSelect bind:value>even whenvalue == undefined(an enum-array form field with no initial value — exactly the approval form'sdefault_payloadcase).MultiSelectthen dereferencedvalue.length/value.map/value.filteronundefined, throwing aTypeErrorthat crashed the entire page render → user sees nothing.Changes
frontend/src/lib/components/select/MultiSelect.svelte: introducelet currentValue = $derived(value ?? [])and route every read (.length,.map,.filter,.includes,reorder) through it. Writes still target the bindablevaluebut base offcurrentValue, so anundefinedinitial value becomes a real array on first mutation. This follows the AGENTS.md recommended alternative ($derivedwith nullish coalescing) rather than the banned$bindable(default_value)pattern.Test plan
ArgInput, soMultiSelectmounts withvalue === undefined. Confirm the page renders (placeholder shown, no blank screen / console error).Fixes WIN-1996
🤖 Generated with Claude Code
Summary by cubic
Fixes a crash in
MultiSelectwhenvalueis undefined that caused the approval page to render blank. Reads now use a derived array so the component renders safely and behaves as expected.$derived(value ?? [])ascurrentValueand route all reads (length,map,filter,includes,reorder) through it.value; an undefined initial value becomes an array on first mutation.ArgInput(Fixes WIN-1996).Written for commit af3a921. Summary will update on new commits.
Review in cubic