Skip to content

Commit

Permalink
STCOM-1056 prevent null in state.layoutCache (#1907)
Browse files Browse the repository at this point in the history
Yeah it's pretty clear, can't have no nulls, fool!
So I can index, index, like I'm supposed to do
Can't have no boom boom when changing column spaces
I need all the right punc in all the right places

I see the state init, it reads initial props
But it don't check for null, so reading dot-paths stops
If you got braces braces, just post 'em up
So you can index an array and you don't ever have to stop

Yeah John Coburn, he told me, "You got to initialize!"
Be like, "If props come in null then defaults will not override."
And so when props come in empty we add our own brand new stash
So traversing the state doesn't blow up on null layoutCache

Because you know it's all about that brace

Supersedes #1095, which was insufficient.

Refs STCOM-1056, again
  • Loading branch information
zburke committed Nov 15, 2022
1 parent 5b124db commit 47d2e52
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
25 changes: 22 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Change history for stripes-components

## 10.3.1 (IN PROGRESS)

* The "Are you sure?" modal window doesn't close when pressing on the "ESC" keyboard button. Refs STCOM-1054.
* `<Paneset>` initializes state more thoroughly, avoiding nulls. Refs STCOM-1056.

## [10.3.0](https://github.com/folio-org/stripes-components/tree/v10.3.0) (2022-10-13)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v10.2.0...v10.3.0)

* Browse contributors > Second pane should not show a horizontal scrollbar. Fixes STCOM-1011.
* Record detail panes are empty when printed. Refs STCOM-975.
* Fix 12-hour formatting in `dateTimeUtils` `getLocalizedTimeFormatInfo`. Fixes STCOM-1017
* Add `inputRef` prop to `<Timepicker>`. Refs STCOM-1016
* `<MultiDownshift>` - highlight first item when searching for options. Fixes STCOM-1015
Expand All @@ -22,6 +29,21 @@
* The vertical scroll bar displays at the second pane when it doesn't need. Fixes STCOM-1044.
* Focus management and accessible labeling of confirmation modals. Confirmation modals announce in a way similart to Javascript alerts. Fixes STCOM-1041.

## [10.2.2](https://github.com/folio-org/stripes-components/tree/v10.2.2) (2022-08-04)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v10.2.1...v10.2.2)

* Browse contributors > Second pane should not show a horizontal scrollbar. Fixes STCOM-1011.
* `<MultiDownshift>` - highlight first item when searching for options. Fixes STCOM-1015
* Pass `modifiers` prop to correct component in `<MultiSelection>`. Fixes STCOM-1013.
* Fix regex matching of search options in `<AdvancedSearch>`. Fixes STCOM-1031.

## [10.2.1](https://github.com/folio-org/stripes-components/tree/v10.2.1) (2022-07-25)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v10.2.0...v10.2.1)

* Fix 12-hour formatting in `dateTimeUtils` `getLocalizedTimeFormatInfo`. Fixes STCOM-1017
* Long titles do not fit in the confirmation modal window header. Refs STCOM-1020
* `<MultiSelection>` must handle null filter string. Refs STCOM-1022.

## [10.2.0](https://github.com/folio-org/stripes-components/tree/v10.2.0) (2022-06-14)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v10.1.0...v10.2.0)

Expand Down Expand Up @@ -69,9 +91,6 @@
* Additional functionality needed for metadata display when user record is deleted. Refs STCOM-882.
* Add the ability to pass a className to the rows container in the `<MultiColumnList>`. Refs STCOM-1009.
* MultiSelection - fix exception when using special characters in search string. Fixes STCOM-1010.
* Browse contributors > Second pane should not show a horizontal scrollbar. Fixes STCOM-1011.
* Record detail panes are empty when printed. Refs STCOM-975.
* The "Are you sure?" modal window doesn't close when pressing on the "ESC" keyboard button. Refs STCOM-1054.

## [10.1.5](https://github.com/folio-org/stripes-components/tree/v10.1.5) (2022-06-06)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v10.1.4...v10.1.5)
Expand Down
5 changes: 4 additions & 1 deletion lib/Paneset/Paneset.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ class Paneset extends React.Component {
getTopmostContainer: this.getTopmostContainer,
},
panes: [],
layoutCache: props.initialLayouts,
// layoutCache must not be null, but initialLayouts may come in that way,
// e.g. if the calling component looks for a cached value but doesn't
// find one then initialLayouts will be present but null.
layoutCache: props.initialLayouts ?? [],
style: initStyle,
changeType: 'init', // eslint-disable-line react/no-unused-state
};
Expand Down

0 comments on commit 47d2e52

Please sign in to comment.