Skip to content

Commit

Permalink
Set default colorings in getDefaultControlsState
Browse files Browse the repository at this point in the history
Centralize the defaults for consistency. Also, this avoids the need to
mark the property as optional on the state.
  • Loading branch information
victorlin committed Nov 6, 2024
1 parent 4fea29e commit b4f1e59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/actions/recomputeReduxState.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,6 @@ const modifyControlsStateViaTree = (state, tree, treeToo, colorings) => {
* only when a file is dropped. (I've gone down too many rabbit holes in this PR to
* do this now, unfortunately.) james, 2023
*/
state.coloringsPresentOnTree = new Set();
state.coloringsPresentOnTreeWithConfidence = new Set(); // subset of above

let coloringsToCheck = [];
if (colorings) {
Expand Down
9 changes: 7 additions & 2 deletions src/reducers/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ export interface BasicControlsState {
canTogglePanelLayout: boolean
colorBy: string
colorByConfidence: boolean
coloringsPresentOnTree?: Set<string>
coloringsPresentOnTreeWithConfidence?: Set<string>
coloringsPresentOnTree: Set<string>

/** subset of coloringsPresentOnTree */
coloringsPresentOnTreeWithConfidence: Set<string>

colorScale?: ColorScale
dateMax: string
dateMaxNumeric: number
Expand Down Expand Up @@ -204,6 +207,8 @@ export const getDefaultControlsState = (): ControlsState => {
colorBy: defaults.colorBy,
colorByConfidence: false,
colorScale: undefined,
coloringsPresentOnTree: new Set(),
coloringsPresentOnTreeWithConfidence: new Set(),
explodeAttr: undefined,
selectedBranchLabel: "none",
showAllBranchLabels: false,
Expand Down

0 comments on commit b4f1e59

Please sign in to comment.