kgabryje commented on code in PR #27891:
URL: https://github.com/apache/superset/pull/27891#discussion_r1568666253
##########
superset-frontend/src/components/AlteredSliceTag/index.tsx:
##########
@@ -149,72 +180,39 @@ class AlteredSliceTag extends React.Component<
if (['filters', 'having', 'where'].includes(fdKey)) {
return;
}
- if (!this.isEqualish(ofd[fdKey], cfd[fdKey])) {
+ if (!isEqualish(ofd[fdKey], cfd[fdKey])) {
diffs[fdKey] = { before: ofd[fdKey], after: cfd[fdKey] };
}
});
return diffs;
- }
+ }, [props.currentFormData, props.origFormData]);
- isEqualish(val1: string, val2: string): boolean {
- return isEqual(alterForComparison(val1), alterForComparison(val2));
- }
+ useEffect(() => {
+ const diffs = getDiffs();
+ const controlsMap = getControlsForVizType(
+ props.origFormData?.viz_type,
+ ) as ControlMap;
+ setRows(getRowsFromDiffs(diffs, controlsMap));
+ setHasDiffs(!isEmpty(diffs));
+ }, [getDiffs, props]);
Review Comment:
Can we replace `props` with `props.origFormData?.viz_type` in deps array?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]