kgabryje commented on code in PR #26155: URL: https://github.com/apache/superset/pull/26155#discussion_r1435003109
########## 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); Review Comment: nit: `const rows` and `const hasDiffs` are a bit redundant, we could do `setRows(getRowsFromDiffs(diffs, controlsMap)` and `setHasDiffs(!isEmpty(diffs))` and save 2 lines -- 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