[Dashboards] Fix page layout navigation edit mode sync#17478
Conversation
Greptile OverviewGreptile SummaryThis PR fixes a synchronization issue with the dashboard edit mode by moving cleanup logic from the global location change handler to a component-specific unmount effect. Key Changes:
Technical Approach: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant PageLayoutRenderer
participant UnmountCleanupEffect
participant PageLayoutState
participant LocationChangeHook
Note over User,LocationChangeHook: Before PR: Global location change resets edit mode
User->>LocationChangeHook: Navigate to different page
LocationChangeHook->>PageLayoutState: Reset edit mode globally
Note over PageLayoutState: Issue: Edit mode reset happens<br/>before component unmount
Note over User,LocationChangeHook: After PR: Scoped cleanup on unmount
User->>PageLayoutRenderer: Mount PageLayout component
PageLayoutRenderer->>UnmountCleanupEffect: Mount cleanup effect
UnmountCleanupEffect->>UnmountCleanupEffect: Setup useEffect cleanup
User->>PageLayoutRenderer: Navigate away
PageLayoutRenderer->>UnmountCleanupEffect: Component unmounting
UnmountCleanupEffect->>PageLayoutState: resetDraftPageLayoutToPersistedPageLayout()
UnmountCleanupEffect->>PageLayoutState: setIsPageLayoutInEditMode(false)
UnmountCleanupEffect->>PageLayoutState: setIsInitialized(false)
Note over UnmountCleanupEffect,PageLayoutState: Cleanup happens at proper time<br/>during component unmount
|
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:24728 This environment will automatically shut down when the PR is closed or after 5 hours. |
|
Hey @ehconitin! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
1 similar comment
|
Hey @ehconitin! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
LogDetails |
navigating away -
before -
CleanShot.2026-01-27.at.19.11.11.mp4
after -
CleanShot.2026-01-27.at.19.08.24.mp4
new dashbaord -
before -
CleanShot.2026-01-27.at.19.11.47.mp4
after -
CleanShot.2026-01-27.at.19.09.41.mp4
empty page layout -
before -
CleanShot.2026-01-27.at.19.13.13.mp4
after -
CleanShot.2026-01-27.at.19.10.24.mp4