kgabryje commented on code in PR #26155: URL: https://github.com/apache/superset/pull/26155#discussion_r1434995729
########## superset-frontend/src/components/AlteredSliceTag/index.jsx: ########## @@ -107,67 +142,38 @@ export default 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; - } - - isEqualish(val1, val2) { - return isEqual(alterForComparison(val1), alterForComparison(val2)); - } - - formatValue(value, key, controlsMap) { - // Format display value based on the control type - // or the value type - if (value === undefined) { - return 'N/A'; - } - if (value === null) { - return 'null'; - } - if (controlsMap[key]?.type === 'AdhocFilterControl') { - if (!value.length) { - return '[]'; + }, []); Review Comment: We're missing dependencies in deps array ########## superset-frontend/src/components/AlteredSliceTag/index.jsx: ########## @@ -107,67 +142,38 @@ export default 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; - } - - isEqualish(val1, val2) { - return isEqual(alterForComparison(val1), alterForComparison(val2)); - } - - formatValue(value, key, controlsMap) { - // Format display value based on the control type - // or the value type - if (value === undefined) { - return 'N/A'; - } - if (value === null) { - return 'null'; - } - if (controlsMap[key]?.type === 'AdhocFilterControl') { - if (!value.length) { - return '[]'; + }, []); + + useEffect(() => { + const diffs = getDiffs(props); + const controlsMap = getControlsForVizType(props.origFormData?.viz_type); + const rows = getRowsFromDiffs(diffs, controlsMap); + const hasDiffs = !isEmpty(diffs); + setRows(rows); + setHasDiffs(hasDiffs); + }, []); Review Comment: Missing dependencies -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org