Skip to content

fix(preview): pass id to windowManager.open from Open in editor button#219

Merged
epeicher merged 1 commit into
trunkfrom
fix/preview-open-in-editor-missing-id
May 15, 2026
Merged

fix(preview): pass id to windowManager.open from Open in editor button#219
epeicher merged 1 commit into
trunkfrom
fix/preview-open-in-editor-missing-id

Conversation

@epeicher

@epeicher epeicher commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Clicking Open in editor in the folder preview pane (right side of a folder window, for a shortcut to a post/page) threw TypeError: windowManager.open(): config.id must be a non-empty string and did nothing.
  • Root cause: renderPostPreview() in src/desktop-files/preview.ts called wm.open() without an id. WindowManager.open() requires config.id to be a non-empty string (src/window-manager/index.ts:384) and throws otherwise.
  • Fix: derive entityId from file.postType (the same shape the Explore details button just above already uses) and pass id: \${entityId}-edit-${postId}`. This matches openEditor()insrc/my-wordpress/index.ts`, so reopening the same shortcut focuses the existing editor window instead of stacking duplicates.

Test plan

  • npm run build clean
  • npm run lint clean
  • ./node_modules/.bin/tsc --noEmit clean
  • npm run test:js (1214/1214 passing)
  • Manual: open a folder containing a post shortcut, select it, click Open in editor → post editor opens in a new window. Click it again → existing window refocuses (no duplicates, no console error).
Open WordPress Playground Preview

The "Open in editor" button in the folder preview pane called
wm.open() without an `id`, which throws since the WindowManager
contract requires a non-empty config.id. Derive the id from the
shortcut's postType so reopens focus the existing editor window
instead of stacking duplicates, mirroring openEditor() in
src/my-wordpress/index.ts.
@epeicher epeicher enabled auto-merge (squash) May 15, 2026 09:38
@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 643bc33 into trunk May 15, 2026
5 checks passed
@epeicher epeicher deleted the fix/preview-open-in-editor-missing-id branch May 15, 2026 09:39
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