pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

Do not automatically close the sidebar while the Page Editor is open

Open twschiller opened this issue 1 year ago • 0 comments

Describe the bug

  • If the mod panel is the only panel open, the sidebar automatically closes when saving a mod because the dynamic element is removed from the page and the saved version is added to the page
  • Auto-closing is jarring with the Chromium Sidepanel and annoying because you have to re-open the sidebar/re-render the panel to continue working

To Reproduce

Steps to reproduce the behavior:

  1. Create a mod package with a sidebar
  2. Run the mod so it's the only sidebar panel
  3. Make a change and save the mod

Actual behavior

The sidebar is automatically closed

Expected behavior

The sidebar is open to the saved version of the mod you are working on

Discussion

  • An alternative approach would be to debounce the hide because the panel will be immediately re-added. However, that would introduce a race condition. Not auto-hiding while the Page Editor is open seems like the easiest approach

Desktop (please complete the following information):

  • Browser: Chrome
  • Extension Version: 1.8.11

Related Code

  • useHideEmptySidebar auto-hides the sidebar if there are no visible panels: https://github.com/pixiebrix/pixiebrix-extension/blob/71182b2a15b942cc70d63587dc8ce5d59411d8cc/src/sidebar/useHideEmptySidebar.ts#L32-L32

twschiller avatar Mar 30 '24 15:03 twschiller