Skip to content
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

Changing Theme during runtime is buggy and doesn't update all values #220

Open
barrymichaeldoyle opened this issue Apr 7, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@barrymichaeldoyle
Copy link

Describe the bug

When implementing a theme toggle functionality. i.e. changing from one theme to another during runtime. The graph does not update all the colors.

Steps to Reproduce the Bug or Issue

Implement a toggle feature in the app as follows (you can use the default light and dark themes)

return (
    <GraphCanvas
      actives={actives}
      draggable
      layoutType="hierarchicalLr"
      cameraMode="pan"
      edges={edges}
      nodes={nodes}
      onCanvasClick={onCanvasClick}
      onNodeClick={handleNodeClick}
      ref={graphRef}
      selections={selections}
      theme={theme === "light" ? lightTheme : darkTheme}
      edgeInterpolation="linear"
    />
)

You will see the same problem effective even if you just update the theme during development and watch it incorrectly re-render with HMR

Expected behavior

I obviously expect that updating a theme during runtime should update all theme values and not just some.

Screenshots or Videos

Light Theme Example:
Screenshot 2024-04-07 at 21 18 09

Dark Theme Example:
Screenshot 2024-04-07 at 21 18 53

What happens when changing from light to dark (BAD):
Screenshot 2024-04-07 at 21 18 33

What happens when changing from dark to light (BAD):
Screenshot 2024-04-07 at 21 20 18

Platform

  • Reagraph Version: [e.g. 4.15.27]
  • OS: [macOS]
  • Browser: [Chrome (arc)]
  • NodeJS version: 20

Your Example Website or App

No response

Additional context

No response

@amcdnl amcdnl added the bug Something isn't working label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants