Skip to content

Commit

Permalink
fall back to default colorBy when valid
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshadfield committed Aug 5, 2018
1 parent aee2daa commit be70819
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/actions/recomputeReduxState.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,12 @@ const checkAndCorrectErrorsInState = (state, metadata, query) => {
if (availableNonGenotypeColorBys.indexOf("gt") > -1) {
availableNonGenotypeColorBys.splice(availableNonGenotypeColorBys.indexOf("gt"), 1);
}
if (availableNonGenotypeColorBys.length) {

if (metadata.defaults && metadata.defaults.colorBy && availableNonGenotypeColorBys.indexOf(metadata.defaults.colorBy) !== -1) {
console.warn("colorBy falling back to", metadata.defaults.colorBy);
state.colorBy = metadata.defaults.colorBy;
state.defaults.colorBy = metadata.defaults.colorBy;
} else if (availableNonGenotypeColorBys.length) {
console.error("Error detected trying to set colorBy to", state.colorBy, "falling back to", availableNonGenotypeColorBys[0]);
state.colorBy = availableNonGenotypeColorBys[0];
state.defaults.colorBy = availableNonGenotypeColorBys[0];
Expand Down

0 comments on commit be70819

Please sign in to comment.