Skip to content

Commit

Permalink
Merge pull request #4650 from oleg-andreyev/fix-useFilterState-compare
Browse files Browse the repository at this point in the history
comparing two objects using lodash.isEqual
  • Loading branch information
fzaninotto authored Apr 7, 2020
2 parents 12f017d + 954e698 commit 487938c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ra-core/src/controller/useFilterState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState, useCallback } from 'react';
import debounce from 'lodash/debounce';
import isEqual from 'lodash/isEqual';
import { Filter } from '../types';

interface UseFilterStateOptions {
Expand Down Expand Up @@ -63,7 +64,7 @@ export default ({
});

useEffect(() => {
if (permanentFilterProp.current !== permanentFilter) {
if (!isEqual(permanentFilterProp.current, permanentFilter)) {
permanentFilterProp.current = permanentFilter;
setFilterValue({
...permanentFilter,
Expand Down

0 comments on commit 487938c

Please sign in to comment.