Skip to content

Enhance onDidLayoutChange Behavior #520

Open
@sachnk

Description

@sachnk

Is your feature request related to a problem? Please describe.
I'm using the onDidLayoutChange change from DockviewApi to detect changes in my layout so I can persist the layout to a database. When the onDidLayoutChange event is fired, I enable a button in my UI to save it. Otherwise, this button is hidden.

It looks like onDidLayoutChange gets fired even when the layout itself hasn't necessarily changed, but the active panel has. The result is that the user gets many spurious calls-to-action to save their layout, even though the only thing that's changed is which panel is currently active.

Is there a way to disambiguate a change in the panel that's currently active vs. an actual physical layout change, where a physical layout change would be a change in dimension, location, etc.

Describe the solution you'd like
It would be great if there was a way to disambiguate the active panel changing vs. a physical layout change. Possible solutions:

  1. Pass a parameter to onDidLayoutChange that describes the nature of the layout change, i.e. a flag indicating whether it's just a active panel change, and/or dimension/location change, etc.

  2. Change the conditions of when onDidLayoutChange is fired to ignore active panel change, and add a new onDidActivePanelChange event for capturing changes in the active panel.

I think option (1) might be preferable because it maintains more backwards compatibility with the existing behavior.

Describe alternatives you've considered
Couldn't find a suitable workaround. Maybe one exists and I've overlooked it?

Additional context
None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions