Skip to content

Commit

Permalink
STCOR-874 provide "key" prop to SessionEventContainer elements (#1521)
Browse files Browse the repository at this point in the history
Without a `key` prop to distinguish the elements rendered by
`<SessionEventContainer>`, they could interact badly. In particular, if
both elements (`<KeepWorkingModal>`, `<FixedLengthSessionWarning>`) were
displayed, dismissing the former would cause the latter to remount,
thus restarting the timer and putting it out of sync with when the
session will actually end.

When React warns you about missing keys, it ain't foolin'!

Refs STCOR-874
  • Loading branch information
zburke committed Aug 16, 2024
1 parent 0095868 commit d4e9f1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Correctly evaluate `stripes.okapi` before rendering `<RootWithIntl>`. Refs STCOR-864.
* `/users-keycloak/_self` is an authentication request. Refs STCOR-866.
* Terminate the session when the fixed-length session expires. Refs STCOR-862.
* Provide `key` to elements in `<SessionEventContainer>`. Refs STCOR-874.

## [10.1.0](https://github.com/folio-org/stripes-core/tree/v10.1.0) (2024-03-12)
[Full Changelog](https://github.com/folio-org/stripes-core/compare/v10.0.0...v10.1.0)
Expand Down
4 changes: 2 additions & 2 deletions src/components/SessionEventContainer/SessionEventContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,12 @@ const SessionEventContainer = ({ history }) => {

// show the idle-session warning modal?
if (isVisible) {
renderList.push(<KeepWorkingModal callback={keepWorkingCallback} />);
renderList.push(<KeepWorkingModal callback={keepWorkingCallback} key="KeepWorkingModal" />);
}

// show the fixed-length session warning?
if (isFlsVisible) {
renderList.push(<FixedLengthSessionWarning />);
renderList.push(<FixedLengthSessionWarning key="FixedLengthSessionWarning" />);
}

return renderList.length ? renderList : null;
Expand Down

0 comments on commit d4e9f1d

Please sign in to comment.