Skip to content

Commit

Permalink
[core] fix(PanelStack2): Prevent extra render due to updated previo…
Browse files Browse the repository at this point in the history
…us panel (#6713)
  • Loading branch information
YoruNoHikage authored Apr 19, 2024
1 parent d30a11f commit 4f034db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/components/panel-stack2/panelView2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ export const PanelView2: PanelView2Component = <T extends Panel<object>>({
previousPanel,
showHeader,
}: PanelView2Props<T>) => {
const hasPreviousPanel = previousPanel !== undefined;
const handleClose = React.useCallback(() => {
// only remove this panel if it is not the only one.
if (previousPanel !== undefined) {
if (hasPreviousPanel) {
onClose(panel);
}
}, [onClose, panel, previousPanel]);
}, [onClose, panel, hasPreviousPanel]);

const maybeBackButton =
previousPanel === undefined ? null : (
Expand Down

1 comment on commit 4f034db

@svc-palantir-github
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[core] fix(`PanelStack2`): Prevent extra render due to updated previous panel (#6713)

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Please sign in to comment.