Skip to content

fix(mini-player): closing hides the window, so reopening never lands on a dead webview - #726

Merged
InstaZDLL merged 1 commit into
mainfrom
fix/mini-reuse-window
Sep 21, 2026
Merged

InstaZDLL merged 1 commit into
mainfrom
fix/mini-reuse-window

Conversation

@InstaZDLL

@InstaZDLL InstaZDLL commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

What happens

Opening the mini-player after the track changed while it was closed shows "No track playing", with the engine playing. Opening it again fixes it, so it looks like every other opening fails.

Evidence gathered on the failing window:

  • In the mini's own console, invoke("player_get_state") answers playing <title>: the engine knows the track, the mini never got its startup snapshot.
  • The backend log prints PostMessage failed … 0x80070578 - Invalid window handle once per mini close, and the main window's console printed Couldn't find callback id — replies reaching a webview that did not ask.

The mini was destroyed on close and re-created under the same mini label. The working explanation is that the new webview's first replies were delivered to the old one's dead handle. It is an explanation that fits every observation, not one read in Tauri's source, so this needs confirming on screen before merging.

The fix

  • Closing and Maximize hide the mini instead of closing it, and openMiniPlayer shows the same window again (it already had that path). Nothing is re-created, so nothing can address a dead handle; reopening is instant and the mini is already up to date.
  • Its Canvas and motion cover are taken down while it is hidden, and come back when it regains focus (openMiniPlayer focuses it).
  • core:window:allow-hide added to the capability: it was never granted.

A behaviour made explicit

openMiniPlayer ended with main.hide(), documented as "hides the main window". The permission was never granted, so that call has always failed and the main window has always stayed visible. That is the behaviour people know, so the call is removed and ui.md now says the main window stays visible.

Checks

bun run typecheck, eslint, prettier, local review clean. Frontend plus one capability line; the capability change needs a restart of tauri dev to take effect.

To verify on screen

  1. Play a track with a Canvas, open and close the mini.
  2. Change track while it is closed, open it again: it must show the new track.
  3. Repeat a few times, with Canvas on and off; the PostMessage failed lines should no longer appear.

Summary by CodeRabbit

  • Nouvelles fonctionnalités

    • Le mini-lecteur laisse désormais la fenêtre principale visible.
    • La fenêtre du mini-lecteur est masquée à la fermeture, puis réutilisée lors de sa réouverture.
    • Le bouton Maximiser remet le mini-lecteur au premier plan sans fermer la fenêtre principale.
  • Améliorations

    • Le décodage des clips, le Canvas et les animations sont suspendus lorsque le mini-lecteur est masqué ou perd le focus, puis réactivés lorsqu’il redevient actif.
    • La réutilisation de la fenêtre évite la création de doublons.

@InstaZDLL InstaZDLL added scope: frontend React/Vite frontend (src/) scope: backend Rust/Tauri backend (src-tauri/) scope: docs Docs, README, assets type: fix Bug fix size: m 50-200 lines labels Sep 21, 2026
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: InstaZDLL/WaveFlow/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 37e950a6-9303-4a12-b548-40f3098bc6b0

📥 Commits

Reviewing files that changed from the base of the PR and between 32d6c07 and cea1cfa.

📒 Files selected for processing (4)
  • docs/features/ui.md
  • src-tauri/crates/app/capabilities/default.json
  • src/components/views/MiniPlayer.tsx
  • src/lib/miniPlayer.ts

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


📝 Walkthrough

Walkthrough

Le mini-lecteur garde la fenêtre principale visible. Sa fenêtre est masquée, puis réutilisée. Le décodage des clips, le canvas et la couverture animée sont suspendus lorsque la fenêtre est masquée ou sans focus.

Changes

Cycle de vie du mini-lecteur

Layer / File(s) Summary
Conservation et réutilisation de la fenêtre
src/lib/miniPlayer.ts, src-tauri/crates/app/capabilities/default.json
openMiniPlayer conserve la fenêtre principale visible et réutilise la fenêtre mini existante. La permission core:window:allow-hide est ajoutée.
Masquage et suspension du rendu
src/components/views/MiniPlayer.tsx, docs/features/ui.md
Les actions de fermeture et de maximisation masquent la fenêtre et la marquent comme stationnée. Le focus contrôle la reprise des clips, du canvas et de la couverture animée. La documentation décrit ce comportement.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant TauriWindow
  participant MiniPlayer
  participant CanvasStage
  TauriWindow->>MiniPlayer: signale la perte ou la reprise du focus
  MiniPlayer->>CanvasStage: désactive ou réactive le canvas
  MiniPlayer->>MiniPlayer: suspend ou reprend le décodage des clips
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Le titre suit le format Conventional Commits et décrit clairement la correction principale du mini-player.
Description check ✅ Passed La description présente le problème, la correction, le comportement attendu, les validations effectuées et les étapes de vérification. Elle ne reprend pas tous les en-têtes du modèle, mais les informa…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (2 skipped: 2 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@InstaZDLL InstaZDLL self-assigned this Sep 21, 2026
@InstaZDLL
InstaZDLL merged commit 772949c into main Sep 21, 2026
17 checks passed
@InstaZDLL
InstaZDLL deleted the fix/mini-reuse-window branch September 21, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: backend Rust/Tauri backend (src-tauri/) scope: docs Docs, README, assets scope: frontend React/Vite frontend (src/) size: m 50-200 lines type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant