Skip to content

chore: [Remote rendering 3.6d] Deliver server state to the browser without sending it back - #171

Open
LKasianAnsys wants to merge 6 commits into
chore/3.6b-resolve-state-on-serverfrom
chore/3.6d-deliver-without-sending
Open

LKasianAnsys wants to merge 6 commits into
chore/3.6b-resolve-state-on-serverfrom
chore/3.6d-deliver-without-sending

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Addresses #24

Context

Until now, when the server sent state to the browser (e.g. on page load, on each rebuild, and when load_state API is called), the browser applied it through the same methods a user action takes, and those methods also report the change to the server. Every delivery therefore echoed back: the UI panel and widget toggles, plus every changed part field, when a user loaded a saved state with load_state. Equality checks hid some of these echoes, but only when the values happened to match. Separately, changing the part visibility of one part in the tree view sent one trigger per part (hide everything, then re-show the visible parts).

In this PR:

  • We give delivered state its own path that applies on the browser without sending to the server, for parts, widget toggles and panels. User actions keep the existing apply-then-send behaviour, but the delivery to the server no longer relies on value equality checks to prevent echoes.
  • We fix the tree view's visibility handling, so that only the part(s) that a user changed results in a send to the server.
  • No user-facing changes.

Manual check:
Run the VISOR server and monitor logs/visor.log

  1. Start VISOR with a multiblock dataset. Select a part, color by a variable, hide a different part in the tree, and collapse the left panel. Expect one line in the VISOR server log per action:
    [trigger] set_part_selected arrived:...
    [trigger] set_part_color_variable arrived:...
    [trigger] set_part_visibility arrived.:...
    [trigger] set_panel_top_left-panel_collapsed arrived: ...
  2. Refresh the page. Expect no arrival lines; before this PR a refresh produced several, for the widget toggles and panel settings.
  3. Run load_state with a file whose values differ from the scene. The parts and panels are updated to reflect the saved state file's values, and no arrival lines appear in the server log: the values came from the server, so there is nothing to report back.
  4. Hide one part in the tree: exactly one set_part_visibility line arrives in the server log (previously, one line per part plus one per visible part would arrive in the logs). Hide a group: expect one line per previously-visible part in that group.

Copilot summary

This pull request refactors the UI panel and scene state management code to use new "apply" methods for updating UI and scene state, replacing the previous "set", "expand", and "collapse" methods. The changes improve clarity, consistency, and separation of concerns between state application and state mutation/reporting, and streamline how UI state is synchronized and updated across the frontend and backend.

Key changes include:

Refactoring UI Panel State Management

  • Replaced expandPanel, collapsePanel, expandLegend, and collapseLegend methods with unified applyPanelCollapsed and applyLegendCollapsed methods in both Panel_TopLeft and Panel_TopRight components, making state updates more declarative and reducing code duplication. [1] [2] [3] [4]
  • Changed tab switching logic to use a new applyTabIndex method instead of selectTab, centralizing tab state application and reporting. [1] Feafd0f3L25R25, [2] [3]

Scene and Renderer State Updates

  • Replaced multiple set*Async methods (e.g., setCrossSectionVisibilityAsync, setEdgeVisibilityGlobalAsync, setDiffuseColorRgbAsync, etc.) with new apply*Async methods for applying scene and part state, improving naming consistency and making intent clearer. [1] [2] [3]

UI State Synchronization

  • Updated the main VisorFrontend class to use the new apply* methods when synchronizing UI state to the panels and scene, ensuring a more consistent and reliable state application process. [1] [2] [3] [4] [5]

Minor Logic Improvements

  • Optimized selection and visibility change listeners in Panel_TopLeft to only update nodes whose state actually changes, reducing unnecessary async calls.

These changes collectively make the codebase easier to maintain, improve separation of UI state application from mutation/reporting, and provide a clearer and more consistent API for updating UI and scene state.

@LKasianAnsys
LKasianAnsys force-pushed the chore/3.6d-deliver-without-sending branch from 73a3a4d to 69f74d2 Compare October 15, 2026 13:39
@LKasianAnsys
LKasianAnsys changed the base branch from chore/3.6b-resolve-state-on-server to main October 15, 2026 13:39
@github-actions github-actions Bot added the test Work associated with testing label Oct 15, 2026
@LKasianAnsys
LKasianAnsys changed the base branch from main to chore/3.6b-resolve-state-on-server October 15, 2026 13:40
@github-actions github-actions Bot removed the test Work associated with testing label Oct 15, 2026
@LKasianAnsys
LKasianAnsys marked this pull request as ready for review October 15, 2026 14:28
@LKasianAnsys
LKasianAnsys force-pushed the chore/3.6b-resolve-state-on-server branch from 285c16f to 2b40e33 Compare October 15, 2026 15:00
@LKasianAnsys
LKasianAnsys force-pushed the chore/3.6d-deliver-without-sending branch from 69f74d2 to 227af31 Compare October 15, 2026 15:02
@LKasianAnsys
LKasianAnsys force-pushed the chore/3.6b-resolve-state-on-server branch from 2b40e33 to a1b3d5d Compare October 16, 2026 17:05
@LKasianAnsys
LKasianAnsys force-pushed the chore/3.6d-deliver-without-sending branch from 227af31 to 029d796 Compare October 16, 2026 17:05
@LKasianAnsys
LKasianAnsys force-pushed the chore/3.6d-deliver-without-sending branch from 029d796 to 3140dee Compare October 16, 2026 17:38

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants