Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use option property to ensure options is treated as state #9953

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

deboer-tim
Copy link
Contributor

What does this PR do?

See #9917 for background. Svelte reuses component instances whenever possible. The problem here is that the Dropdown options are being set via child option elements, created via buildOptions. When you switch pages all of the explicitly set properties and state are applied, but since options is not set as a property, nor state, it is not applied.

The simplest fix in this case is using the options parameter directly, which we do in other cases and causes Svelte to correctly treat it as state.

This is only avoiding the problem though, so I've opened #9952 for future follow up. I've checked and we have no other child options where this would currently happen, but the real fix is possibly a Svelte fix, removing child option support, or finding a fix directly in Dropdown.

Screenshot / video of UI

N/A

What issues does this PR fix or reference?

Fixes #9917.

How to test this PR?

See #9917.

@deboer-tim deboer-tim requested review from benoitf and a team as code owners November 18, 2024 19:09
@deboer-tim deboer-tim requested review from cdrage and SoniaSandler and removed request for a team November 18, 2024 19:09
@axel7083
Copy link
Contributor

Some tests are failing

See podman-desktop#9917 for background. Svelte reuses component instances whenever possible. The
problem here is that the Dropdown options are being set via child option elements,
created via buildOptions. When you switch pages all of the explicitly set properties
and state are applied, but since options is not set as a property, nor state, it is
not applied.

The simplest fix in this case is using the options parameter directly, which we do
in other cases and causes Svelte to correctly treat it as state.

This is only avoiding the problem though, so I've opened podman-desktop#9952 for future follow up.
I've checked and we have no other child options where this would currently happen,
but the real fix is possibly a Svelte fix, removing child option support, or finding
a fix directly in Dropdown.

Fixes podman-desktop#9917.

Signed-off-by: Tim deBoer <git@tdeboer.ca>
The test was bad - checking the text content of a select or dropdown _always_
passes when the value you're looking for is also a child option. Switching to
not use children exposes the invalid test.

This just removes the invalid line, which reverts this test to exactly where it
was before we added Dropdown, just checking that the correct component is used.
The correct initial selection behaviour is checked in the following test.

Signed-off-by: Tim deBoer <git@tdeboer.ca>
Copy link
Contributor

@axel7083 axel7083 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@cdrage cdrage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested and it's updating correctly.

@deboer-tim deboer-tim merged commit c845732 into podman-desktop:main Dec 16, 2024
18 checks passed
@podman-desktop-bot podman-desktop-bot added this to the 1.16.0 milestone Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preferences -> Update and Light Mode Preferences Dropdown values are switching
4 participants