lyndsiWilliams commented on a change in pull request #12873:
URL: https://github.com/apache/superset/pull/12873#discussion_r568259960
##########
File path: superset-frontend/src/SqlLab/components/TemplateParamsEditor.jsx
##########
@@ -68,23 +60,27 @@ export default class TemplateParamsEditor extends
React.Component {
} catch (e) {
isValid = false;
}
- this.setState({ parsedJSON, isValid, codeText });
+ setState({ parsedJSON, isValid, codeText });
const newValue = isValid ? codeText : '{}';
- if (newValue !== this.props.code) {
- this.props.onChange(newValue);
+ if (newValue !== code) {
+ onChange(newValue);
}
- }
+ };
+
+ useEffect(() => {
+ onChange(codeText);
+ }, [codeText]);
- renderDoc() {
- return (
+ const modalBody = (
+ <div>
<p>
- {t('Assign a set of parameters as')}
+ 'Assign a set of parameters as'
Review comment:
I removed the single quotes in the most recent commit, it works properly
locally. I ran the tests in SqlEditor_spec:
<img width="376" alt="Screen Shot 2021-02-01 at 7 17 31 PM"
src="https://user-images.githubusercontent.com/55605634/106539640-fa8ee080-64c3-11eb-8556-f0b786d03516.png">
but I didn't see any tests specifically for TemplateParamsEditor.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]