uncaught exception: undefined

pull/1451/head
Rick Carlino 2019-09-19 10:24:54 -05:00
parent 84affe3464
commit e5bfa4997c
2 changed files with 33 additions and 39 deletions

View File

@ -1,40 +1,34 @@
import * as React from "react";
import { connect } from "react-redux";
// import { TaggedSequence, TaggedFbosConfig } from "farmbot";
import { TaggedSequence, TaggedFbosConfig } from "farmbot";
import { Everything } from "../../../interfaces";
// import { selectAllSequences } from "../../../resources/selectors";
// import { getFbosConfig } from "../../../resources/getters";
import { selectAllSequences } from "../../../resources/selectors";
import { getFbosConfig } from "../../../resources/getters";
// interface Props {
// fbosConfig: TaggedFbosConfig;
// sequences: TaggedSequence[];
// dispatch: Function;
// }
interface Props {
fbosConfig: TaggedFbosConfig;
sequences: TaggedSequence[];
dispatch: Function;
}
function mapStateToProps(_p: Everything) {
return {};
// const { index } = p.resources;
// const fbosConfig = getFbosConfig(index);
// if (fbosConfig) {
// return {
// fbosConfig,
// sequences: selectAllSequences(index),
// dispatch: p.dispatch,
// };
// } else {
// throw new Error("No config found?");
// }
function mapStateToProps(p: Everything) {
const { index } = p.resources;
const fbosConfig = getFbosConfig(index);
if (fbosConfig) {
return {
fbosConfig,
sequences: selectAllSequences(index),
dispatch: p.dispatch,
};
} else {
throw new Error("No config found?");
}
}
@connect(mapStateToProps)
export class BootSequenceSelector extends React.Component<{}, {}> {
componentDidCatch() {
return <div>Not ready</div>;
}
export class BootSequenceSelector extends React.Component<Props, {}> {
render() {
return <div>
Loading...
</div>;
return <div> Ey... </div>;
}
}

View File

@ -196,18 +196,18 @@ const BEFORE_HOOKS: IndexerHook = {
};
const AFTER_HOOKS: IndexerHook = {
Device: (i) => {
const conf = getFbosConfig(i);
FbosConfig: (_i) => {
// const conf = getFbosConfig(i);
if (conf && conf.body.boot_sequence_id) {
const tracker = i.inUse["Sequence.FbosConfig"];
const sequence =
findByKindAndId(i, "Sequence", conf.body.boot_sequence_id);
tracker[sequence.uuid] = tracker[sequence.uuid] || {};
tracker[sequence.uuid][conf.uuid] = true;
} else {
i.inUse["Sequence.FbosConfig"] = {};
}
// if (conf && conf.body.boot_sequence_id) {
// const tracker = i.inUse["Sequence.FbosConfig"];
// const sequence =
// findByKindAndId(i, "Sequence", conf.body.boot_sequence_id);
// tracker[sequence.uuid] = tracker[sequence.uuid] || {};
// tracker[sequence.uuid][conf.uuid] = true;
// } else {
// i.inUse["Sequence.FbosConfig"] = {};
// }
},
FarmEvent: reindexAllFarmEventUsage,
Sequence: reindexAllSequences,