#4545: Fix for sidebar unable to be opened (edge condition) #4546
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Resolves #4545
Impact: minor
Type: bugfix
Issue
After performing a specific set of steps in the UI (see issue), the admin sidebar becomes unusable.
Solution
There was a piece of logic in
productGridContainer.jsthat automatically closed the sidebar if the admin didn't have any products selected in the grid. It was checking whether the user'sselectedGridItemspreference was empty (empty array or undefined). After performing the reproduction steps, that preference is set to an empty array.To prevent the auto-close logic from re-runing, I set
selectedGridItemsto undefined when auto-closing the sidebar, and updated the logic to only run ifselectedGridItemsis an empty array.Breaking changes
None
Testing