-
Notifications
You must be signed in to change notification settings - Fork 226
🐛fix: update edge styles on theme toggle in WecsTopology #2394
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
base: dev
Are you sure you want to change the base?
Conversation
|
Welcome to KubeStellar! 🚀 Thank you for submitting this Pull Request. Before your PR can be merged, please ensure: ✅ DCO Sign-off - All commits must be signed off with ✅ PR Title - Must start with an emoji: ✨ (feature), 🐛 (bug fix), 📖 (docs), 🌱 (infra/tests), Getting Started with KubeStellar: Contributor Resources:
🌟 Help KubeStellar Grow - We Need Adopters! Our roadmap is driven entirely by adopter feedback. Whether you're using KubeStellar yourself or know someone who could benefit from multi-cluster Kubernetes: 📋 Take our Multi-Cluster Survey - Share your use cases and help shape our direction! A maintainer will review your PR soon. Feel free to ask questions in the comments or on Slack! |
|
Hi @AAdIprog. Thanks for your PR. I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this 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 fixes an issue where edge styles in the WECS topology view would not update when toggling between light and dark themes. Previously, edges retained the style of the theme active when they were first created.
Changes:
- Imported
useTreeViewEdgeshook to access theme-aware edge styling logic - Added a
useEffecthook that triggers on theme changes to update existing edge styles - Applied minor indentation formatting fixes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // Update edge styles when theme changes | ||
| useEffect(() => { |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hook useTreeViewEdges is called unconditionally but creates memoized callbacks that depend on theme and edgeType. However, the updateEdgeStyles function is included in the dependency array of the useEffect at line 619, which could cause the effect to run more frequently than necessary. Since updateEdgeStyles is recreated when edgeType changes (due to being memoized with edgeType in TreeViewEdges.tsx line 157), this will trigger the useEffect even when only edgeType changes, not just theme. Consider either: (1) removing updateEdgeStyles from the dependency array and only depending on theme, or (2) wrapping the updateEdgeStyles call in a conditional check to ensure it only updates when theme changes.
| // Update edge styles when theme changes | |
| useEffect(() => { | |
| const prevThemeRef = useRef(theme); | |
| // Update edge styles when theme changes | |
| useEffect(() => { | |
| if (prevThemeRef.current === theme) { | |
| return; | |
| } | |
| prevThemeRef.current = theme; |
| const { updateEdgeStyles } = useTreeViewEdges({ theme: theme as 'light' | 'dark' }); | ||
|
|
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type assertion theme as 'light' | 'dark' is used because useTheme returns theme: string (line 4 in themeStore.ts), but useTreeViewEdges expects theme: 'light' | 'dark'. This type assertion bypasses TypeScript's type safety. Consider updating the ThemeStateType interface in themeStore.ts to define theme: 'light' | 'dark' instead of theme: string to eliminate the need for type assertions and improve type safety throughout the codebase.
| const { updateEdgeStyles } = useTreeViewEdges({ theme: theme as 'light' | 'dark' }); | |
| const normalizedTheme: 'light' | 'dark' = theme === 'dark' ? 'dark' : 'light'; | |
| const { updateEdgeStyles } = useTreeViewEdges({ theme: normalizedTheme }); |
ca7f95f to
1396c2e
Compare
|
@Nupurshivani Can you check this once again as there were some issues with the previous pull request |
|
LGTM label has been added. DetailsGit tree hash: 53436a2745566e1ffbe081fa05802b62726e4cd3 |
|
/approve |
…stellar#2398) (kubestellar#2399) Signed-off-by: hiirrxnn <hiren2004sharma@gmail.com>
…lusters" and "recent activity" (kubestellar#2391) * feat(ui): update cluster icons to 'Network' representation for better semantics Signed-off-by: Arnav Gogia <arnavgogia404@gmail.com> * chore: format code with Prettier Signed-off-by: Arnav Gogia <arnavgogia404@gmail.com> * fix(ui): add missing dependency to useCallback in Dashboard metrics Signed-off-by: Arnav Gogia <arnavgogia404@gmail.com> * chore: update CI workflow to use Node 20 Signed-off-by: Arnav Gogia <arnavgogia404@gmail.com> * chore(tests): fix formatting in ContextDropdown.test.tsx for CI check Signed-off-by: Arnav Gogia <arnavgogia404@gmail.com> --------- Signed-off-by: Arnav Gogia <arnavgogia404@gmail.com>
Signed-off-by: AAdIprog <aadishah132@gmail.com>
1396c2e to
4ea8a61
Compare
|
New changes are detected. LGTM label has been removed. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: btwshivam, clubanderson The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
This PR addresses a visual consistency issue in the WECS topology view where edge styles (colors, shadows, markers) would not update when the application theme was toggled between light and dark modes. Previously, edges retained the style of the theme that was active when they were first created.
Related Issue
Fixes #2270
Changes Made
useEffecthook in WecsTopology.tsx that triggers onthemechanges.updateEdgeStyleswhen the theme changes, ensuring immediate visual feedback without requiring a graph refresh.themeprop to ensure compatibility.Checklist
Please ensure the following before submitting your PR:
Video Demonstration:
[
Screen.Recording.2026-01-14.at.1.27.10.PM.mov
]
Additional Notes
This fix leverages the existing
updateEdgeStylesfunction from TreeViewEdges to ensure consistent behavior across different topology views.