michael-s-molina commented on a change in pull request #16994:
URL: https://github.com/apache/superset/pull/16994#discussion_r724111293
##########
File path:
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
##########
@@ -105,10 +105,17 @@ const FilterValue: React.FC<FilterProps> = ({
time_range,
});
const filterOwnState = filter.dataMask?.ownState || {};
+ // TODO: We should try to improve our useEffect hooks to depend more on
+ // granular information instead of big objects that require deep
comparison.
+ const customizer = (
+ objValue: Partial<QueryFormData>,
+ othValue: Partial<QueryFormData>,
+ key: string,
+ ) => (key === 'url_params' ? true : undefined);
if (
!isRefreshing &&
- (!areObjectsEqual(formData, newFormData) ||
- !areObjectsEqual(ownState, filterOwnState) ||
+ (!isEqualWith(formData, newFormData, customizer) ||
Review comment:
I'm not sure if I agree. This is the implementation of `areObjectsEqual`:
```
export function areObjectsEqual(
obj1: any,
obj2: any,
opts = { ignoreUndefined: false },
) {
let comp1 = obj1;
let comp2 = obj2;
if (opts.ignoreUndefined) {
comp1 = omitBy(obj1, isUndefined);
comp2 = omitBy(obj2, isUndefined);
}
return isEqual(comp1, comp2);
}
```
The first thing is that is very inefficient because it creates new objects
(`omitBy`) only for the purpose of removing the properties that are
`undefined`. The second thing is that this seems to be a `customizer`
implementation and not a new version of `isEqual`. I think the best approach
would be to have pre-defined customizers to use with Lodash `isEqualWith`. What
do you think?
--
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]