Skip to content

Commit 96da21c

Browse files
BACKLOG-21054: Fix legacy picker for vanity urls (#247)
* BACKLOG-21054: Fix legacy picker for vanity urls * Remove setting defaultOpenPaths in render
1 parent c70ed8c commit 96da21c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/data-helper/src/legacy/Picker.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class Picker extends React.Component<PropType, StateType> {
149149

150150
this.eventsHandlers = {};
151151

152-
if (openPaths === null) {
152+
if (!openPaths) {
153153
// Uncontrolled mode
154154
state.isOpenControlled = false;
155155
state.openPaths = [];
@@ -171,7 +171,7 @@ export class Picker extends React.Component<PropType, StateType> {
171171
}
172172
}
173173

174-
if (selectedPaths === null) {
174+
if (!selectedPaths) {
175175
// Uncontrolled mode
176176
state.isSelectControlled = false;
177177
state.selectedPaths = defaultSelectedPaths ? clone(defaultSelectedPaths) : [];
@@ -205,7 +205,7 @@ export class Picker extends React.Component<PropType, StateType> {
205205
}
206206

207207
static getDerivedStateFromProps(nextProps: PropType, prevState: StateType) {
208-
if ((prevState.isOpenControlled !== (nextProps.openPaths !== null)) || (prevState.isSelectControlled !== (nextProps.selectedPaths !== null))) {
208+
if ((prevState.isOpenControlled !== Boolean(nextProps.openPaths)) || (prevState.isSelectControlled !== Boolean(nextProps.selectedPaths))) {
209209
console.warn('Cannot change between controlled/uncontrolled modes');
210210
}
211211

@@ -346,7 +346,7 @@ export class Picker extends React.Component<PropType, StateType> {
346346

347347
render() {
348348
const selectedPaths = this.state.selectedPaths ? this.state.selectedPaths : this.props.selectedPaths;
349-
let openPaths = this.state.openPaths ? this.state.openPaths : this.props.openPaths;
349+
let openPaths = this.state.openPaths || this.props.openPaths;
350350
const {setRefetch} = this.props;
351351

352352
openPaths = clone(openPaths);

0 commit comments

Comments
 (0)