Skip to content

Recover internal preview when opening an external preview fails #4597

Description

@coderabbitai

Summary

External-preview opening can fail after the internal preview has already been hidden, leaving users without either preview. Define and implement reliable recovery for this failure path.

Rationale

External previews are an existing feature and failures should not leave the preview UI in an unavailable state.

Affected area

  • Flow.Launcher/ViewModel/MainViewModel.cs
  • External-preview open/close/switch orchestration in PluginManager

Required changes

  • Make the external-preview open operation expose whether it completed successfully (or otherwise make failure unambiguous to its callers).
  • When opening an external preview fails after hiding the internal preview, restore the appropriate internal preview.
  • Preserve the successful external-preview behavior and keep ExternalPreviewVisible consistent with the actual outcome.
  • Cover the failure/recovery path with focused tests where the surrounding UI architecture permits.

Acceptance criteria

  • A failed external-preview open does not leave the user with no preview when an internal preview is available.
  • The external-preview visibility state is not marked visible after a failed open.
  • Existing successful external-preview and internal-preview flows remain unchanged.

Requested by @DavidGBrett.

Related PR: #4529
Originating review discussion: #4529 (comment)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions