Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
😬 can't figure out which test is causing tests to fail in py2
Browse files Browse the repository at this point in the history
  • Loading branch information
chriddyp committed Mar 30, 2019
1 parent 102bc20 commit c37e351
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"format": "prettier --config .prettierrc --write src/**/*.js src/**/*.react.js",
"format:test": "prettier --config .prettierrc src/**/*.js src/**/*.react.js --list-different",
"test": "npm run lint",
"test:py": "python -m unittest tests.test_clientside tests.test_render tests.test_race_conditions"
"test:py": "python -m unittest -v tests.test_clientside tests.test_render tests.test_race_conditions"
},
"author": "chriddyp",
"license": "MIT",
Expand Down
73 changes: 46 additions & 27 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,36 +531,55 @@ function updateOutput(
return;
}

const [outputId, outputProp] = payload.output.split('.');
const updatedProps = {
[outputProp]: returnValue,
};
function updateOutput(outputIdAndProp, outputValue) {
const [outputId, outputProp] = outputIdAndProp.split('.');
const updatedProps = {
[outputProp]: outputValue,
};

/*
* Update the request queue by treating a successful clientside
* like a succesful serverside response (200 status code)
*/
updateRequestQueue(false, STATUS.OK);
/*
* Update the request queue by treating a successful clientside
* like a succesful serverside response (200 status code)
*/
updateRequestQueue(false, STATUS.OK);

// Update the layout with the new result
dispatch(
updateProps({
itempath: getState().paths[outputId],
props: updatedProps,
source: 'response',
})
);
// Update the layout with the new result
dispatch(
updateProps({
itempath: getState().paths[outputId],
props: updatedProps,
source: 'response',
})
);

/*
* This output could itself be a serverside or clientside input
* to another function
*/
dispatch(
notifyObservers({
id: outputId,
props: updatedProps,
})
);
/*
* This output could itself be a serverside or clientside input
* to another function
*/
dispatch(
notifyObservers({
id: outputId,
props: updatedProps,
})
);
}

if (payload.output.startsWith('..')) {
/*
* If this update is for multiple outputs, then it has
* starting & trailing `..` and each propId pair is separated
* by `...`, e.g.
* "..output-1.value...output-2.value...output-3.value...output-4.value.."
*/
const outputPropIds = payload.output.split('...').map(
o => o.replace('..', '') // trim starting & trailing ..
);
for(let i=0; i < outputPropIds.length; i++) {
updateOutput(outputPropIds[i], returnValue[i]);
}
} else {
updateOutput(payload.output, returnValue);
}

/*
* Note that unlike serverside updates, we're not handling
Expand Down

0 comments on commit c37e351

Please sign in to comment.