fix(Suggestion): initialize the empty state - #5189
Open
olemartinorg wants to merge 1 commit into
Open
Conversation
The creatable-button redesign made the empty option persistent and delegated its visibility to input and selection events. Before either event occurs, a Suggestion with available options can therefore show its no-results message alongside those options. Run the same empty-state synchronization from the existing mutation-driven render path so initial and asynchronously rendered options start in the correct state. Cover the initial render to prevent this event-order regression from returning.
🦋 Changeset detectedLatest commit: 804ed42 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
olemartinorg
marked this pull request as ready for review
August 14, 2026 08:29
olemartinorg
requested review from
Barsnes,
eirikbacker and
mimarz
as code owners
August 14, 2026 08:29
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.
Summary
Initialize Suggestion's empty-state visibility when its options are rendered, instead of waiting for the first input or selection event.
Root cause
PR #5097 changed
Suggestion.Emptyfrom conditionally rendered React content to a persistent option whose visibility is managed byhandleEmpty. However,handleEmptywas only registered forinputandcomboboxafterselectevents.When a Suggestion initially rendered with selectable options, neither event had occurred yet. The empty option therefore remained visible alongside the real options until the user typed or selected something.
We discovered this while validating the Designsystemet upgrade in Altinn/altinn-studio#19766. Altinn's Dropdown ordering tests received the Norwegian “no results” message as the first option instead of the expected country. This blocks our progress validating the upgrades to Designsystemet 1.18.0 and 1.19.0.
Fix
Run the existing
handleEmptysynchronization from Suggestion's mutation-driven render path. This covers initial and asynchronously rendered options while retaining the existing input and selection updates.The regression test renders an empty-state option together with a selectable option and verifies that the empty state is hidden without requiring user interaction. It failed before the fix with
empty.hidden === false.Verification
biome check packages/web/src/suggestion/suggestion.ts packages/web/src/suggestion/suggestion.test.tspnpm build:web