Fix bug when selecting "All users" in explorer (#1388)

This fixes a bug introduced in #1371, where selecting a type other than
"All users" and then trying to reselect "All users" would break the UI.

Test plan: Manual inspection; load an instance, try selecting a
different type, and then go back to "All users". It now works as
expected.
This commit is contained in:
Dandelion Mané 2019-09-19 14:01:17 +02:00 committed by GitHub
parent 007568d3f0
commit 8f46d7d812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -11,6 +11,7 @@ import Link from "../webutil/Link";
import {WeightConfig} from "./weights/WeightConfig"; import {WeightConfig} from "./weights/WeightConfig";
import {WeightsFileManager} from "./weights/WeightsFileManager"; import {WeightsFileManager} from "./weights/WeightsFileManager";
import {type PluginDeclaration} from "../analysis/pluginDeclaration"; import {type PluginDeclaration} from "../analysis/pluginDeclaration";
import * as NullUtil from "../util/null";
export type Props = { export type Props = {
projectId: string, projectId: string,
@ -164,12 +165,13 @@ export class TimelineExplorer extends React.Component<Props, State> {
<label> <label>
<span style={{marginLeft: "5px"}}>Showing: </span> <span style={{marginLeft: "5px"}}>Showing: </span>
<select <select
value={this.state.selectedNodeTypePrefix} value={NullUtil.orElse(this.state.selectedNodeTypePrefix, "")}
onChange={(e) => onChange={(e) => {
this.setState({selectedNodeTypePrefix: e.target.value}) const selectedNodeTypePrefix = e.target.value || null;
} this.setState({selectedNodeTypePrefix});
}}
> >
<option key={null} value={null}> <option key={"All users"} value={""}>
All users All users
</option> </option>
{this.state.timelineCred.plugins().map(optionGroup)} {this.state.timelineCred.plugins().map(optionGroup)}