Skip to content

Fix native app windows restoring the wrong saved instance - #763

Open
nickhamze wants to merge 1 commit into
trunkfrom
fix/native-window-session-restore
Open

Fix native app windows restoring the wrong saved instance#763
nickhamze wants to merge 1 commit into
trunkfrom
fix/native-window-session-restore

Conversation

@nickhamze

@nickhamze nickhamze commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

What this fixes

OpenStation apps can keep multiple windows open at once. That is essential for apps such as Fleet, where each window may represent a different WordPress site.

After a desktop reload, OpenStation restored the first native app window but could lose additional instances. The unused saved state could then be picked up by a newly opened window, making that window show the previous saved destination instead of the site the user selected. The reproduction did not send remote content writes, but destination identity must be reliable before multi-site management is safe to launch.

What changed

  • Restores every saved native instance through the stable registered app ID while preserving its exact saved window ID.
  • Passes site parameters, geometry, desktop assignment, window state, and grid placement directly to the owning app.
  • Reserves saved IDs while lazy framework and app bundles load, so a new window cannot claim an ID that restoration still needs.
  • Clears abandoned restore state when an app has been disabled or removed.
  • Uses the same identity-safe restore path for mobile recents.
  • Keeps the original session stacking and focus order.

There are no new REST endpoints, authentication changes, database migrations, or plugin-facing setup steps.

User-visible result

Before: site A returned, site B disappeared, and opening site C could reopen B under the reused second-window ID.

After: site A returns as fleet-site, site B returns as fleet-site-2, and site C opens independently as fleet-site-3.

Verification

  • Full JavaScript suite: 5,849 tests passed across 471 files.
  • Focused restore, registry, delayed-loading, mobile, and window-allocation suite: 90 tests passed.
  • TypeScript type checking passed.
  • ESLint passed with only the repository existing file-length warnings.
  • Complete development and production bundle build passed.
  • Release ZIP packaging passed.
  • Packaged end-to-end Fleet regression passed in the disposable 100-site WordPress lab: both saved site windows restored with the correct identities, then a third requested site opened with its own identity.

The Fleet regression used only local disposable fixtures and made no remote content writes.

Open WordPress Playground Preview

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.

1 participant