Skip to content

Commit

Permalink
fix Time Series Viewer QF crash bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Frencil committed Sep 8, 2020
1 parent 329fa39 commit a83a85f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ declare namespace AvailabilityContext {
export { useAvailabilityState };
export { SORT_DIRECTIONS };
}
/**
Context Provider
*/
declare function Provider(props: any): JSX.Element;
declare namespace Provider {
export namespace propTypes {
Expand Down
8 changes: 4 additions & 4 deletions lib/components/DataProductAvailability/AvailabilityContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var DEFAULT_STATE = {
*/

var hydrateNeonContextData = function hydrateNeonContextData(state, neonContextData) {
var newState = _extends(_extends({}, state), {}, {
var newState = _extends({}, state, {
neonContextHydrated: true
});

Expand Down Expand Up @@ -124,7 +124,7 @@ var calculateRows = function calculateRows(state) {
return state;
}

var newState = _extends(_extends({}, state), {}, {
var newState = _extends({}, state, {
rows: {},
rowLabels: [],
rowTitles: {}
Expand Down Expand Up @@ -270,7 +270,7 @@ var reducer = function reducer(state, action) {
*/


var Context = (0, _react.createContext)(DEFAULT_STATE);
var Context = /*#__PURE__*/(0, _react.createContext)(DEFAULT_STATE);

var useAvailabilityState = function useAvailabilityState() {
var hookResponse = (0, _react.useContext)(Context);
Expand Down Expand Up @@ -301,7 +301,7 @@ var Provider = function Provider(props) {
*/


var initialState = _extends(_extends({}, (0, _cloneDeep.default)(DEFAULT_STATE)), {}, {
var initialState = _extends({}, (0, _cloneDeep.default)(DEFAULT_STATE), {
sites: sites
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export default BasicAvailabilityInterface;
/**
Main Function
*/
declare function BasicAvailabilityInterface(props: any): JSX.Element;
declare namespace BasicAvailabilityInterface {
export namespace propTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ var EnhancedAvailabilityInterface = function EnhancedAvailabilityInterface(props
};

return /*#__PURE__*/_react.default.createElement("div", {
style: _extends(_extends({}, optionDivStyle), {}, {
style: _extends({}, optionDivStyle, {
marginRight: _Theme.default.spacing(3)
}),
"data-selenium": "data-product-availability.breakout-options"
Expand Down
4 changes: 2 additions & 2 deletions lib/components/TimeSeriesViewer/TimeSeriesViewerGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ function TimeSeriesViewerGraph() {
var posData = state.product.sites[siteCode].positions[position].data; // Null-fill if this site/position/month/variable has no series data or no dateTime data

if (!posData[month] || !posData[month][pkg] || !posData[month][pkg][timeStep] || !posData[month][pkg][timeStep].series[variable] || !posData[month][pkg][timeStep].series[dateTimeVariable]) {
for (var t = monthIdx; t < monthStepCount; t += 1) {
for (var t = monthIdx; t < monthIdx + monthStepCount; t += 1) {
newData[t][columnIdx] = null;
}

Expand Down Expand Up @@ -507,7 +507,7 @@ function TimeSeriesViewerGraph() {
var posData = state.product.sites[siteCode].positions[position].data; // If this site/position/month/variable has no series data then fill with nulls

if (!posData[month] || !posData[month][pkg] || !posData[month][pkg][timeStep] || !posData[month][pkg][timeStep].series[qf]) {
for (var t = monthIdx; t < monthStepCount; t += 1) {
for (var t = monthIdx; t < monthIdx + monthStepCount; t += 1) {
newQualityData[t][columnIdx] = _toConsumableArray(qfNullFill);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export default function TimeSeriesViewerGraph() {
|| !posData[month][pkg][timeStep].series[variable]
|| !posData[month][pkg][timeStep].series[dateTimeVariable]
) {
for (let t = monthIdx; t < monthStepCount; t += 1) {
for (let t = monthIdx; t < monthIdx + monthStepCount; t += 1) {
newData[t][columnIdx] = null;
}
return;
Expand Down Expand Up @@ -437,7 +437,7 @@ export default function TimeSeriesViewerGraph() {
|| !posData[month][pkg][timeStep]
|| !posData[month][pkg][timeStep].series[qf]
) {
for (let t = monthIdx; t < monthStepCount; t += 1) {
for (let t = monthIdx; t < monthIdx + monthStepCount; t += 1) {
newQualityData[t][columnIdx] = [...qfNullFill];
}
return;
Expand Down

0 comments on commit a83a85f

Please sign in to comment.