Skip to content

fix: open each post as its own window from the Posts window#176

Merged
epeicher merged 1 commit into
trunkfrom
fix/posts-window-derive-id-collision
May 12, 2026
Merged

fix: open each post as its own window from the Posts window#176
epeicher merged 1 commit into
trunkfrom
fix/posts-window-derive-id-collision

Conversation

@epeicher
Copy link
Copy Markdown
Collaborator

@epeicher epeicher commented May 12, 2026

Summary

Clicking a second post in the Posts window refocused the first post's window instead of opening a new one.

deriveWindowId() collapsed every post.php?post=X&action=edit URL to the same ID (post-php) because post wasn't in IDENTITY_PARAMS — only post_type, page, taxonomy, and path were significant. So every post-edit URL produced the same window ID, and windowManager.open() saw a matching window and refocused it.

Fix

Add post to IDENTITY_PARAMS so post.php?post=123&action=editpost-php-post-123 and post.php?post=456&action=editpost-php-post-456. Every code path that derives a window ID (Posts-window row click via openAdminUrl, in-shell <a href> clicks via the link interceptor, dock-icon clicks, session restore, geometry lookups) benefits automatically since they all funnel through deriveWindowId.

Test plan

  • npm run lint, tsc --noEmit, full vitest (1116 tests) green
  • New regression test in tests/vitest/utils.test.ts locks in distinct IDs for two post URLs
  • Manual: open the Posts window, click Post A → opens Post A window; click Post B → opens Post B as a separate window; click Post A again → refocuses the existing Post A window
Open WordPress Playground Preview
`post.php?post=X&action=edit` URLs collapsed to a single window ID
(`post-php`) because `post` wasn't in `IDENTITY_PARAMS`. Clicking a
second post in the Posts list refocused the first post's window
instead of opening the new one.

Add `post` to `IDENTITY_PARAMS` so each post's edit URL derives a
distinct window ID, and add a regression test.
@epeicher epeicher enabled auto-merge (squash) May 12, 2026 11:35
@github-actions
Copy link
Copy Markdown
Contributor

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@epeicher epeicher merged commit d4f6c16 into trunk May 12, 2026
5 checks passed
@epeicher epeicher deleted the fix/posts-window-derive-id-collision branch May 12, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant