Frontmatter
| id | 8071 |
| title | Refactor LivePreview to handle multi-window logic internally |
| state | Closed |
| labels | enhancementairefactoring |
| assignees | tobiu |
| createdAt | Dec 9, 2025, 4:56 PM |
| updatedAt | Dec 9, 2025, 5:19 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8071 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Dec 9, 2025, 5:19 PM |
Refactor LivePreview to handle multi-window logic internally
tobiu assigned to @tobiu on Dec 9, 2025, 4:56 PM

tobiu
Dec 9, 2025, 5:19 PM
Input from Gemini 3.0:
✦ I have completed the refactoring to decouple
LivePreviewfromViewportController.Changes Implemented:
- Logic Internalization:
Neo.code.LivePreviewnow self-manages its multi-window lifecycle. It directly subscribes toNeo.currentWorkerconnectanddisconnectevents.- Configuration: Added a
windowUrlconfig toLivePreview(defaults to./childapps/preview/index.html), allowing for flexible deployment paths.- Clean Separation: Removed all
PortalPreview-specific logic and theonAppConnectmethod fromPortal.view.ViewportController.- Feature Guard: The pop-out functionality and event listeners are now strictly conditional on
Neo.config.useSharedWorkers.The component is now portable and reusable across different Neo.mjs applications without requiring a specific controller implementation. The embedding app is only responsible for providing the physical child app files (as referenced by
windowUrl) to ensure correct worker path resolution.
tobiu closed this issue on Dec 9, 2025, 5:19 PM
This refactoring aims to decouple the
Neo.code.LivePreviewcomponent from thePortal.view.ViewportController.Scope:
onAppConnectandonAppDisconnectlogic fromViewportController.mjsdirectly intoLivePreview.mjs.LivePreviewwill subscribe directly toNeo.currentWorkerevents.windowUrlconfig toLivePreview(default:'./childapps/preview/index.html') to allow apps to customize the location of the preview entry point.pop-outbutton and event listeners are only active ifNeo.config.useSharedWorkersis true.PortalPreviewspecific logic fromapps/portal/view/ViewportController.mjs.Note on Child Apps: This refactor retains the requirement for the embedding application to provide the physical child app files (index.html, app.mjs) to ensure correct worker path resolution in production builds.