the sections in dashboard are not visible after hiding once for custom dashboards and…
- User
the sections in dashboard are not visible after hiding once for custom dashboards and main dashboard investigate the issue and implement a fix
Assistant
I'll invoke the systematic-debugging skill since this is a bug investigation.
Assistant
Using systematic debugging to investigate the section visibility issue.
Phase 1: Root Cause Investigation
Let me first explore how section visibility works in the dashboard components to understand the hiding mechanism.
Assistant
Excellent! The exploration has identified a clear root cause. Let me verify by reading the specific code sections.
Assistant
Let me also check the custom dashboard handler to understand the full flow.
Assistant
Let me check how the
DashboardGrouptype defines thecollapsedproperty and thetoDashboardconversion.Assistant
Let me check the
toDashboardfunction and the DashboardGroup type definition.Assistant
Let me check the DashboardSection component to see how the collapse toggle UI works.
Assistant
Let me check the SectionHeader component and also look at one of the main dashboards (like node-tab) to see how sections are defined there.
Assistant
Let me check the DashboardPage component to see how it handles the dashboard prop and if there's anything that could cause remounting.
Assistant
I've completed my investigation. Based on my analysis, I've identified the root cause and will now write the plan.
Root Cause Summary:
The issue is in dashboard-panel-container.tsx:384 where section collapse state is determined:
typescriptconst isCollapsed = sectionCollapseStates.get(section.sectionIndex) ?? section.group?.collapsed ?? false;The problem: When
sectionCollapseStatesMap doesn't have an entry for a section, it falls back tosection.group?.collapsed. However, there's no initialization effect forsectionCollapseStates(unlikepanelCollapseStateswhich has one at lines 225-240).This causes a state synchronization issue:
- User collapses a section → local state
sectionCollapseStatesis updated - Config is saved with
collapsed: trueviasaveConfigQuiet - If the component remounts or sections change, is reset to empty Map
- User collapses a section → local state
Assistant
I've analyzed the issue and written a plan. The fix is straightforward - adding an initialization effect for
sectionCollapseStatessimilar to the existing one forpanelCollapseStates.Assistant
Now I'll implement the fix. Let me add the initialization effect for
sectionCollapseStates.- User
[Request interrupted by user]
- User
no i do not want the collapse part persistent
Assistant
I understand - you don't want the collapse state to persist. So the issue is that once you collapse a section, you can't expand it again (the toggle doesn't work properly)?
Let me clarify what you want:
- Current behavior: Section collapse state is being persisted to storage, and once hidden, sections can't be shown again
- Desired behavior: Collapse/expand should just work locally without persistence, and always be toggleable
Should I:
- Option A: Remove the collapse state persistence entirely (sections always start expanded on page load)
- Option B: Fix the toggle so it works properly (expand/collapse works, but still persists the state)
- Option C: Something else?
What's your preference?
- User
option a
Assistant
Got it. I'll remove the collapse state persistence so sections always start expanded and the toggle just works locally.
Assistant
Now let me remove the persistence callback from custom-dashboard-tab.tsx.
Assistant
Let me remove the unused
handleSectionCollapseChangefunction.Assistant
Let me also remove the unused
saveConfigQuietfunction.Assistant
The fix is complete. Here's a summary of the changes:
Changes made:
-
dashboard-panel-container.tsx:384 - Changed collapse state to only use local state, ignoring persisted
collapsedvalues:typescript// Before: fell back to persisted config value const isCollapsed = sectionCollapseStates.get(section.sectionIndex) ?? section.group?.collapsed ?? false; // After: defaults to false (expanded) const isCollapsed = sectionCollapseStates.get(section.sectionIndex) ?? false; -
custom-dashboard-tab.tsx - Removed the collapse state persistence:
- Removed
onSectionCollapseChangeprop fromDashboardPage - Removed unused
handleSectionCollapseChangefunction - Removed unused function
- Removed
-