Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STCOM-1386 Paneset: check for existing id before registering pane #2395

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* `<Tooltip>` should allow for tooltip content to be hovered without closing the tooltip. Refs STCOM-1391.
* `<AdvancedSearchRow>` - change `aria-label` for the input box to enter a search query and the Boolean operator dropdown. Refs STCOM-1195.
* *BREAKING* Update `@csstools` postcss plugins to current versions in sync with `@folio/stripes-cli`. Refs STCOM-1404.
* Paneset - deduplicate panes via `id` prior to registration. Refs STCOM-1386.

## [12.2.0](https://github.com/folio-org/stripes-components/tree/v12.2.0) (2024-10-11)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v12.1.0...v12.2.0)
Expand Down
13 changes: 9 additions & 4 deletions lib/Paneset/Paneset.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,15 @@ class Paneset extends React.Component {
this.interval = null;
});
} else {
// insert sorted by left coordinate of clientrect...
const newPanes = insertByClientRect(newState.panes, paneObject);
newState = Object.assign(newState, { panes: newPanes, changeType: 'added' });
// newState = this.insertPaneObject(newState, paneObject);
// check for duplicate id's before registering. Registration happens on mount.
// This will help with mount-twice strict mode strangeness
const paneExists = newState.panes.findIndex((p) => p.id === paneObject.id)
if (paneExists === -1) {
// insert sorted by left coordinate of clientrect...
const newPanes = insertByClientRect(newState.panes, paneObject);
newState = Object.assign(newState, { panes: newPanes, changeType: 'added' });
// newState = this.insertPaneObject(newState, paneObject);
}
}
return newState;
}, () => {
Expand Down
Loading