Skip to content

feat: [Remote rendering 4.2a] Move CLIENT mode viewer wiring out of app - #184

Open
LKasianAnsys wants to merge 4 commits into
feat/4.1d-add-server-rendering-modefrom
feat/4.2a-move-client-mode-wiring-out-of-app
Open

LKasianAnsys wants to merge 4 commits into
feat/4.1d-add-server-rendering-modefrom
feat/4.2a-move-client-mode-wiring-out-of-app

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Addresses #27

Context

This PR moves the client-mode viewer wiring out of App.tsx into useClientVtk and shares the frontend build, so that server mode can add its own hook beside it and reuse the same build. Until now, App.tsx has held that wiring directly, so a second rendering mode would not have a clean place to plug in.

This is a pure refactor, no behaviour changes.

Copilot summary

This pull request refactors the client-side viewer wiring for CLIENT mode, moving key logic out of App.tsx and into dedicated hooks and helper modules. The changes modularize and clarify how the frontend is constructed, how the renderer and event listeners are managed, and how the camera sync reporter is attached and released. This improves maintainability, testability, and ensures that event listeners are correctly cleaned up when the frontend is replaced.

Refactoring and Modularization:

  • Moved CLIENT mode viewer wiring logic from App.tsx into a new custom hook useClientVtk and a helper function buildFrontendAsync, significantly simplifying App.tsx and centralizing the logic for connecting to the wasm scene, rebuilding the frontend, and handling server updates. [1] [2] [3] [4]

  • Introduced useVisorArgs and useClientVtk hooks to encapsulate argument handling and client-mode renderer management, replacing ad-hoc logic in App.tsx.

Event Listener Management and Cleanup:

  • Changed the way event listeners are managed in VisorFrontend: replaced the camera sync listener release method with a generalized release method that removes all listeners registered by the frontend. This ensures that no stale listeners remain after a rebuild, preventing duplicate event handling. [1] [2] [3]

  • Moved the attachment of the camera sync reporter from VisorFrontend to the CLIENT mode hook, so it is now attached to the renderer at creation time and released at the correct lifecycle point. [1] [2]

Documentation and Testing:

  • Updated documentation in CameraSyncReporter.ts to clarify its role as the client-mode reporter, now attached by the hook, and to improve the explanation of listener lifecycles and testing rationale. [1] [2]

@github-actions github-actions Bot added added enhancement New feature or request labels Oct 22, 2026
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.1d-add-server-rendering-mode branch from 26fa6a3 to 63b6e49 Compare October 26, 2026 14:15
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.2a-move-client-mode-wiring-out-of-app branch from 11e0806 to cdd67ea Compare October 26, 2026 14:15
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.2a-move-client-mode-wiring-out-of-app branch from cdd67ea to 279ad21 Compare October 26, 2026 17:27
@LKasianAnsys LKasianAnsys self-assigned this Oct 26, 2026
@LKasianAnsys
LKasianAnsys marked this pull request as ready for review October 26, 2026 17:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

added enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants