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

Commit c37e351

Browse files
committed
😬 can't figure out which test is causing tests to fail in py2
1 parent 102bc20 commit c37e351

File tree

2 files changed

+47
-28
lines changed

2 files changed

+47
-28
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"format": "prettier --config .prettierrc --write src/**/*.js src/**/*.react.js",
1616
"format:test": "prettier --config .prettierrc src/**/*.js src/**/*.react.js --list-different",
1717
"test": "npm run lint",
18-
"test:py": "python -m unittest tests.test_clientside tests.test_render tests.test_race_conditions"
18+
"test:py": "python -m unittest -v tests.test_clientside tests.test_render tests.test_race_conditions"
1919
},
2020
"author": "chriddyp",
2121
"license": "MIT",

Diff for: src/actions/index.js

+46-27
Original file line numberDiff line numberDiff line change
@@ -531,36 +531,55 @@ function updateOutput(
531531
return;
532532
}
533533

534-
const [outputId, outputProp] = payload.output.split('.');
535-
const updatedProps = {
536-
[outputProp]: returnValue,
537-
};
534+
function updateOutput(outputIdAndProp, outputValue) {
535+
const [outputId, outputProp] = outputIdAndProp.split('.');
536+
const updatedProps = {
537+
[outputProp]: outputValue,
538+
};
538539

539-
/*
540-
* Update the request queue by treating a successful clientside
541-
* like a succesful serverside response (200 status code)
542-
*/
543-
updateRequestQueue(false, STATUS.OK);
540+
/*
541+
* Update the request queue by treating a successful clientside
542+
* like a succesful serverside response (200 status code)
543+
*/
544+
updateRequestQueue(false, STATUS.OK);
544545

545-
// Update the layout with the new result
546-
dispatch(
547-
updateProps({
548-
itempath: getState().paths[outputId],
549-
props: updatedProps,
550-
source: 'response',
551-
})
552-
);
546+
// Update the layout with the new result
547+
dispatch(
548+
updateProps({
549+
itempath: getState().paths[outputId],
550+
props: updatedProps,
551+
source: 'response',
552+
})
553+
);
553554

554-
/*
555-
* This output could itself be a serverside or clientside input
556-
* to another function
557-
*/
558-
dispatch(
559-
notifyObservers({
560-
id: outputId,
561-
props: updatedProps,
562-
})
563-
);
555+
/*
556+
* This output could itself be a serverside or clientside input
557+
* to another function
558+
*/
559+
dispatch(
560+
notifyObservers({
561+
id: outputId,
562+
props: updatedProps,
563+
})
564+
);
565+
}
566+
567+
if (payload.output.startsWith('..')) {
568+
/*
569+
* If this update is for multiple outputs, then it has
570+
* starting & trailing `..` and each propId pair is separated
571+
* by `...`, e.g.
572+
* "..output-1.value...output-2.value...output-3.value...output-4.value.."
573+
*/
574+
const outputPropIds = payload.output.split('...').map(
575+
o => o.replace('..', '') // trim starting & trailing ..
576+
);
577+
for(let i=0; i < outputPropIds.length; i++) {
578+
updateOutput(outputPropIds[i], returnValue[i]);
579+
}
580+
} else {
581+
updateOutput(payload.output, returnValue);
582+
}
564583

565584
/*
566585
* Note that unlike serverside updates, we're not handling

0 commit comments

Comments
 (0)