You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Refactor LivePreview to handle multi-window logic internally
23
25
@@ -33,9 +35,28 @@ This refactoring aims to decouple the `Neo.code.LivePreview` component from the
33
35
**Note on Child Apps:**
34
36
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.
35
37
38
+
## Comments
39
+
40
+
### @tobiu - 2025-12-09 16:19
41
+
42
+
**Input from Gemini 3.0:**
43
+
44
+
> ✦ I have completed the refactoring to decouple `LivePreview` from `ViewportController`.
45
+
>
46
+
> **Changes Implemented:**
47
+
> 1.**Logic Internalization:**`Neo.code.LivePreview` now self-manages its multi-window lifecycle. It directly subscribes to `Neo.currentWorker``connect` and `disconnect` events.
48
+
> 2.**Configuration:** Added a `windowUrl` config to `LivePreview` (defaults to `./childapps/preview/index.html`), allowing for flexible deployment paths.
49
+
> 3.**Clean Separation:** Removed all `PortalPreview`-specific logic and the `onAppConnect` method from `Portal.view.ViewportController`.
50
+
> 4.**Feature Guard:** The pop-out functionality and event listeners are now strictly conditional on `Neo.config.useSharedWorkers`.
51
+
>
52
+
> 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.
53
+
36
54
## Activity Log
37
55
38
56
- 2025-12-09 @tobiu added the `enhancement` label
39
57
- 2025-12-09 @tobiu added the `ai` label
40
58
- 2025-12-09 @tobiu added the `refactoring` label
59
+
- 2025-12-09 @tobiu assigned to @tobiu
60
+
- 2025-12-09 @tobiu referenced in commit `d9e86fc` - "Refactor LivePreview to handle multi-window logic internally #8071"
# Enhance LivePreview: Add destroy logic and rename connection handlers
23
+
24
+
This ticket covers two improvements for `Neo.code.LivePreview`:
25
+
26
+
1.**Clean up on destroy**:
27
+
When a `LivePreview` instance is destroyed, it should ensure its associated pop-out window is closed.
28
+
- Implement a `destroy()` method.
29
+
- Use `Neo.Main.windowClose({names: [this.id]})` to close the specific window associated with this instance.
30
+
31
+
2.**Rename connection handlers**:
32
+
To improve clarity regarding the data source (window vs app), rename the worker connection listeners:
33
+
-`onAppConnect` -> `onWindowConnect`
34
+
-`onAppDisconnect` -> `onWindowDisconnect`
35
+
- The events receive `appName` and `windowId`, but since `appName` is not unique across tabs, `windowId` is the key identifier. Renaming reflects this focus.
0 commit comments