Skip to content

A slow saved-slicer check can undo a slicer saved in Settings #186

Closed

Description

@vycdev

Summary

If Open in Slicer is still checking the saved slicer when you save a new choice in Settings, the check can undo that save once it finishes. The window is only as long as one native lookup, usually a few milliseconds, so this is unlikely in practice.

Found while reviewing #175.

Cause

onOpenInSlicer in src/hooks/useSlicerChoice.ts captures the current preference, then awaits findSlicerApp(preference.app.path). Nothing checks whether the preference changed while it waited:

  • If the old slicer is missing: it calls updatePreference(null), which clears the slicer the user just saved in Settings, and opens the chooser.
  • If the old slicer is found: it opens the model in the old slicer, not the one just saved.

Steps to reproduce

Only reproducible with a delayed lookup, for example by stubbing findSlicerApp in a test:

  1. Save slicer A with Always use this slicer, then make A unavailable.
  2. Click Open in A while the lookup is held.
  3. In Settings, use Change… to save slicer B.
  4. Release the lookup. B is gone from Settings and the chooser asks again.

Expected

A lookup that finishes after the preference changed does nothing to the newer choice.

Possible fix

Before acting on the result, compare the preference the lookup started with against the latest one (through a ref or a request counter), and drop the result if it changed. A small unit test with a deferred findSlicerApp covers it.

Activity

  1. added
    bug
    on Nov 19, 2026
  2. added a commit that references this issue on Nov 19, 2026
    32399a6
  3. vycdev commented on Nov 19, 2026

    @vycdev
    OwnerAuthor

    Fixed by #189, merged into develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions