Skip to content

[debt] Graph: consolidate state management and improve computed state #4482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 14, 2025

Conversation

d13
Copy link
Member

@d13 d13 commented Jul 9, 2025

  • Moved GraphAppState into GraphStateProvider, reducing re-rendering due to duplicated state changes
  • Updated GlAppHost to support more complex state providers
  • Improved graph theming performance
    • Removed unneeded CSS custom properties being applied to the DOM
    • Reduced JS-based color computation in favor of color-mix()
    • Moved color computation specific to the graph component into the graph wrapper

- moves graph theme from GraphAppState to graph wrapper
- reduces JS-based color computing
- removes computing colors of CSS custom properties
- renames components for clarity
@d13 d13 added the debt Technical debt label Jul 9, 2025
@d13 d13 force-pushed the debt/graph-cleanup branch from 7107bd1 to e29c1f1 Compare July 9, 2025 22:40
@d13 d13 force-pushed the debt/graph-cleanup branch from e29c1f1 to 9574c44 Compare July 10, 2025 18:58
@d13 d13 requested review from Copilot and eamodio July 11, 2025 14:39
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR centralizes graph-related state into a single provider, extends the app host to accept custom providers, and offloads color computations into a lightweight wrapper using CSS color-mix().

  • Migrate GraphAppState into a unified GraphStateProvider with debounced context updates.
  • Update GlAppHost to support specialized StateProvider types.
  • Refactor graph theming into gl-graph-wrapper, replacing JS color math with CSS-based mixing.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/webviews/plus/graph/protocol.ts Dropped theming from the shared protocol and simplified callback.
src/webviews/apps/shared/components/signal-utils.ts Extended signalState/signalObjectState with afterChange hooks.
src/webviews/apps/shared/appHost.ts Generalized GlAppHost to accept a Provider generic.
src/webviews/apps/plus/graph/stateProvider.ts Consolidated state in GraphStateProvider and added debounce logic.
src/webviews/apps/plus/graph/graph.ts Adapted GraphAppHost to the new provider pattern, removed legacy theming.
src/webviews/apps/plus/graph/graph-wrapper/graph-wrapper.ts Introduced theming wrapper with CSS mixing, removed legacy theming.
src/webviews/apps/plus/graph/graph-wrapper/gl-graph.ts Renamed React wrapper imports to match new naming.
src/webviews/apps/plus/graph/graph-wrapper/gl-graph.react.tsx Renamed GraphWrapperReact to GlGraphReact, updated props typing.
src/webviews/apps/plus/graph/graph-header.ts Updated header to consume the unified state provider.
src/webviews/apps/plus/graph/graph-app.ts Switched rendering and handlers to use graphState.
src/system/color.ts Added getCssMixedColorValue and getCssOpacityColorValue.
Comments suppressed due to low confidence (1)

src/webviews/apps/plus/graph/graph-wrapper/graph-wrapper.ts:346

  • Consider adding unit tests for getCssVariableValue and getGraphTheming to validate CSS variable fallbacks and dynamic theme updates, preventing regressions in theming behavior.
function getCssVariableValue(

@justinrobots justinrobots added this to the 17.4 milestone Jul 11, 2025
@d13 d13 force-pushed the debt/graph-cleanup branch from 6c5e3c6 to e741017 Compare July 14, 2025 20:07
@d13 d13 requested a review from eamodio July 14, 2025 20:30
Copy link
Member

@eamodio eamodio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@d13 d13 merged commit 5292ac5 into main Jul 14, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants