fix: pane relayout order - #1678
Conversation
Reviewer's GuideRefactors the pane relayout pipeline so panes are sorted and re-binned using up-to-date React state in a single relayout pass, removes direct state mutation and callback-string indirection, and ensures saved-view and filter changes trigger exactly one consistent relayout. Sequence diagram for the updated relayout pipelinesequenceDiagram
actor User
participant FilterControls
participant App
participant storeData
participant BinPacker as _bin
User ->> FilterControls: onFilterChange
FilterControls ->> App: relayout({ filterString })
App ->> App: getCurrLayoutList()
App ->> App: sortLayout(prev.layout)
App ->> App: rebin(sorted, layoutID)
App ->> BinPacker: _bin.position(idx, windowSize.current.cols)
App ->> storeData: setStoreData(prev => { panes, layout })
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
@rajnisht7 @Jayantparashar10 @vedansh-5 @Manik-Khajuria-5 Please review |
Manik-Khajuria-5
left a comment
There was a problem hiding this comment.
@tonypzy I was going through the code rebin() is currently mutating _bin.current from within the setStoreData updater. Since React may replay state updaters, it'd be safer to keep the updater pure and move the _bin.current assignment outside of it. Could we separate the layout computation from the bin reconstruction?
done |
There was a problem hiding this comment.
@tonypzy Please make the below mentioned changes . Rest of code LGTM !
Description
relayoutto sort panes before creating the bin and update pane/layout state together using a functional state update.relayoutcalls by passing the latest layout and filter values explicitly.Motivation and Context
The panes had already been reordered, but the layout engine was still calculating positions using the old order and dimensions. Additionally, React state updates are asynchronous and do not take effect immediately.
Besides, switching saved views called
relayoutthree times, and Repack called it twice. Now, both operations callrelayoutonly once.How Has This Been Tested?
N/A
Screenshots (if appropriate):
N/A
Types of changes
Checklist:
py/visdom/VERSIONaccording to Semantic VersioningSummary by Sourcery
Simplify pane relayout so panes are re-sorted and re-binned in a single, consistent state update and callbacks run after React commits state.
Bug Fixes:
Enhancements: