Skip to content

[Feature] Local Play should warn when the local dev server is down instead of failing silently #439

Description

@ranjith7022

Summary

When the Vite dev server stops while a code app is open through the Local Play URL, the app keeps running normally with no visual indication that anything changed. HMR is silently dead — edits no longer appear — so developers often don't notice until their changes "don't work." Refreshing during the outage shows only "We could not retrieve your app."

This is a common workflow interruption (dev server crash, accidental Ctrl+C, restart onto a different port that stales the saved Local Play URL), and today there's no out-of-the-box signal at any layer.

Environment

  • @microsoft/power-apps-vite 1.0.2
  • Vite 8.0.13, @microsoft/power-apps-cli 1.0.0 (pa app run)
  • Windows 11, Chrome 153

Repro steps

  1. Run pa app run, open the printed Local Play URL
  2. Kill the dev server process
  3. Observe: the loaded app continues working normally — no error, no warning
  4. Edit any source file → nothing happens (HMR websocket is gone)
  5. Refresh while the server is still down → player error screen

What would help

Any of the following would address it — happy with whatever the team thinks fits best in the platform:

  1. In-app indicator injected by the Vite plugin — e.g. a banner/toast when the HMR websocket drops, cleared on reconnect. I validated this approach locally using Vite's client events (vite:ws:disconnect / vite:ws:connect) and it works inside the Local Play iframe.
  2. Player-side improvement — when the player can't reach _localAppUrl/_localConnectionUrl, show an actionable message ("Your local dev server at http://localhost:5173 isn't reachable — restart pa app run") instead of the generic "We could not retrieve your app."
  3. CLI-level guardrails — e.g. a stable/port-pinning option for pa app run so saved Local Play URLs don't go stale after a restart.
  4. Docs — if none of the above are planned short-term, a note in the debugging docs about this failure mode and its recovery path.

Why it matters

  • The embedded-player workflow makes the existing console-only message ([vite] server connection lost. Polling for restart...) effectively invisible
  • The current refresh error doesn't point at the actual cause, so developers debug their app instead of their terminal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions