fix(app): use optional chaining for model.current() in ProviderIcon#18927
Merged
adamdotdevin merged 1 commit intoanomalyco:devfrom Mar 24, 2026
Merged
fix(app): use optional chaining for model.current() in ProviderIcon#18927adamdotdevin merged 1 commit intoanomalyco:devfrom
adamdotdevin merged 1 commit intoanomalyco:devfrom
Conversation
Replace non-null assertion (!) with optional chaining (?.) and empty string fallback for the ProviderIcon id prop. The SolidJS compiler turns the prop into a getter that can fire during a reactive batch before the <Show> guard disposes children, causing a TypeError when model.current() becomes undefined.
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Andres77872
pushed a commit
to Andres77872/opencode
that referenced
this pull request
Mar 26, 2026
dzianisv
pushed a commit
to dzianisv/opencode
that referenced
this pull request
Mar 26, 2026
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.
Issue for this PR
Closes #18923
Type of change
What does this PR do?
prompt-input.tsxuseslocal.model.current()!.provider.idwith a non-null assertion inside a<Show>guard. SolidJS compilesid={expr}into aget id()getter. During a reactive batch, the getter can fire before<Show>disposes its children, causing a TypeError whenmodel.current()becomes undefined (e.g. provider refresh, model not found).Replaces the
!assertion with optional chaining (?.) and an empty string fallback at both occurrences (lines 1500 and 1532). The<Show>guard still prevents rendering when the model is undefined; the fallback only fires during the reactive race window.How did you verify your code works?
bun testpasses forpackages/app(291/291)can't access property 'provider', r.model.current() is undefinedno longer occursChecklist