[7.x] [Canvas] Fix context elements issue with Element Stats (#32510) (#32538)

Backports the following commits to 7.x:
 - [Canvas] Fix context elements issue with Element Stats  (#32510)
This commit is contained in:
Clint Andrew Hall 2019-03-05 21:49:51 -06:00 committed by GitHub
parent 554478f4ce
commit 96197f7a87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View file

@ -14,7 +14,7 @@ export const ElementConfig = ({ elementStats }) => {
}
const { total, ready, error } = elementStats;
const progress = Math.round(((ready + error) / total) * 100);
const progress = total > 0 ? Math.round(((ready + error) / total) * 100) : 100;
return (
<Fragment>

View file

@ -10,6 +10,7 @@ import { get } from 'lodash';
import { prepend } from '../../lib/modify_path';
import * as actions from '../actions/resolved_args';
import { flushContext, flushContextAfterIndex } from '../actions/elements';
import { setWorkpad } from '../actions/workpad';
/*
Resolved args are a way to handle async values. They track the status, value, and error
@ -130,6 +131,9 @@ export const resolvedArgsReducer = handleActions(
return state;
}, transientState);
},
[setWorkpad]: (transientState, {}) => {
return set(transientState, 'resolvedArgs', {});
},
},
{}
);

View file

@ -90,6 +90,12 @@ export function getElementCounts(state) {
Object.keys(resolvedArgs).forEach(resolvedArg => {
const arg = resolvedArgs[resolvedArg];
const { expressionRenderable } = arg;
if (!expressionRenderable) {
results.pending++;
return;
}
const { value, state } = expressionRenderable;
if (value && value.as === 'error') {