Skip to content

Fix stale prerequisite validation when switching from Docker to Podman#757

Open
Iamliuxiaozhen wants to merge 4 commits into
TibixDev:mainfrom
Iamliuxiaozhen:oliver/issues/756
Open

Fix stale prerequisite validation when switching from Docker to Podman#757
Iamliuxiaozhen wants to merge 4 commits into
TibixDev:mainfrom
Iamliuxiaozhen:oliver/issues/756

Conversation

@Iamliuxiaozhen
Copy link
Copy Markdown

Summary

This fixes a setup wizard bug where the Next button could remain enabled after switching the container runtime from Docker to Podman, even though Podman prerequisites had not been validated yet.

What changed

  • replaced the async computed containerSpecs state with an explicit watch on containerRuntime
  • clear the previous runtime's prerequisite state immediately when the runtime changes
  • added a request id guard so outdated async checks cannot overwrite the latest runtime state

Why

The previous implementation could briefly reuse the old runtime's successful prerequisite result while the new runtime check was still in flight. That allowed users to continue with stale validation state.

Testing

  • switched between Docker and Podman in the setup prerequisites step
  • confirmed the Next button is disabled immediately after switching runtimes
  • confirmed the button only becomes enabled again after the current runtime's prerequisites pass

Related

Comment thread src/renderer/views/SetupUI.vue
@Iamliuxiaozhen
Copy link
Copy Markdown
Author

Good catch, that was my mistake. I removed the import while replacing the async prerequisite check for containerSpecs, but computedAsync is still used below for the install folder validations. I’ve added the import back in 8023b98.

@waffles-dev
Copy link
Copy Markdown
Collaborator

Good catch, that was my mistake. I removed the import while replacing the async prerequisite check for containerSpecs, but computedAsync is still used below for the install folder validations. I’ve added the import back in 8023b98.

Please restore it to the original line so there's no diff, thanks :)

Copy link
Copy Markdown
Owner

@TibixDev TibixDev left a comment

Choose a reason for hiding this comment

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

Assuming computedAsync is what breaks here for some reason, wouldn't it be easier to have a simple watch that directly reassigns containerSpecs? The operation isn't heavy enough to require the duplication check (or if it is, let me know), so we can avoid having a request counter and all that stuff.

Shouldn't it be like two lines that way? Just reassign as ref as you did and use an immediate watcher on the runtime.

Let me know. 😄

@TibixDev
Copy link
Copy Markdown
Owner

Oh and additionally, if it does take a longer time, we can have some boolean ref such as checkingPrerequisites that'd turn false/true before and after the check, and conditionally disable the button with <existing> || checkingPrerequisites

Comment thread src/renderer/views/SetupUI.vue Outdated
@Iamliuxiaozhen
Copy link
Copy Markdown
Author

Thanks, updated this to immediately mark prerequisites as checking from the runtime picker change handler, clear the previous specs synchronously, and disable Next while the current runtime checks are running. I also simplified the watcher and removed the request counter.

@waffles-dev
Copy link
Copy Markdown
Collaborator

Thanks, updated this to immediately mark prerequisites as checking from the runtime picker change handler, clear the previous specs synchronously, and disable Next while the current runtime checks are running. I also simplified the watcher and removed the request counter.

I can still click fast enough after selecting Podman in the drop down that it lets me through when it shouldn't.

@Iamliuxiaozhen
Copy link
Copy Markdown
Author

Thanks for re-testing. I moved the guard earlier than the x-select change event by marking prerequisites as checking from the runtime menu item interaction itself (pointerdown, Enter, and click). I also changed the Next button click handler to re-check the prerequisite state before advancing, so even if the disabled state has not visually updated yet, the click path should no longer let the wizard through.

Refactor setup step interactions to make runtime switching and step transitions safer and more consistent.

- Add `beginContainerRuntimeChange(runtime)` and call it from menu item `pointerdown`, `keydown.enter`, and `click` handlers
- Reuse the same function in `handleContainerRuntimeChange` to centralize runtime-change behavior
- Skip runtime updates when the selected runtime is already active to avoid unnecessary prerequisite rechecks and state resets
- Replace inline `currentStepIdx++` with `goToInstallLocationStep()` so advancing is blocked while checks are running or prerequisites are not satisfied

This prevents redundant state churn and avoids moving forward before setup requirements are valid.fix(setup-ui): harden runtime switch and step navigation

Refactor setup step interactions to make runtime switching and step transitions safer and more consistent.

- Add `beginContainerRuntimeChange(runtime)` and call it from menu item `pointerdown`, `keydown.enter`, and `click` handlers
- Reuse the same function in `handleContainerRuntimeChange` to centralize runtime-change behavior
- Skip runtime updates when the selected runtime is already active to avoid unnecessary prerequisite rechecks and state resets
- Replace inline `currentStepIdx++` with `goToInstallLocationStep()` so advancing is blocked while checks are running or prerequisites are not satisfied

This prevents redundant state churn and avoids moving forward before setup requirements are valid.
@waffles-dev
Copy link
Copy Markdown
Collaborator

Thanks for re-testing. I moved the guard earlier than the x-select change event by marking prerequisites as checking from the runtime menu item interaction itself (pointerdown, Enter, and click). I also changed the Next button click handler to re-check the prerequisite state before advancing, so even if the disabled state has not visually updated yet, the click path should no longer let the wizard through.

Thanks. It's working well for me. Bear with us - we'll get it reviewed eventually :)

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.

[Bug] You can still continue switching from Docker to Podman even if the conditions are not met.

3 participants