Skip to content

Commit

Permalink
Fix SidePanel's main content size during async onClose callback (#2516)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer authored May 21, 2024
1 parent 01e1544 commit d3ce6bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-dogs-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sumup/circuit-ui': patch
---

Fixed the size of the main content while the SidePanel's `onClose` callback is pending.
8 changes: 4 additions & 4 deletions packages/circuit-ui/components/SidePanel/SidePanelContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ export function SidePanelProvider({

const sidePanelIndex = sidePanelsRef.current.indexOf(panel);

if (!isInstantClose) {
setIsPrimaryContentResized(sidePanelIndex !== 0);
}

// Remove the side panel and all panels above it in reverse order
const sidePanelsToRemove = sidePanelsRef.current
.slice(sidePanelIndex)
Expand All @@ -163,6 +159,10 @@ export function SidePanelProvider({
await promisify(sidePanel.onClose);
}

if (!isInstantClose) {
setIsPrimaryContentResized(sidePanelIndex !== 0);
}

await new Promise<void>((resolve) => {
const lastPanel = index === sidePanelsToRemove.length - 1;

Expand Down

0 comments on commit d3ce6bf

Please sign in to comment.