Skip to content

Commit

Permalink
Remove stripFns, now that @wry/equality handles functions better.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Jul 16, 2020
1 parent 920d1b0 commit 18b0912
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/react/data/QueryData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import {
} from '../types/types';
import { OperationData } from './OperationData';

const stripFns = ({ onCompleted, onError, ...rest }: any = {}) => rest;

export class QueryData<TData, TVariables> extends OperationData {
public onNewData: () => void;

Expand Down Expand Up @@ -241,15 +239,12 @@ export class QueryData<TData, TVariables> extends OperationData {
children: null
};

// When comparing new options against previously stored options,
// we'll ignore callback functions since their identities are not
// stable, meaning they'll always show as being different. Ignoring
// them when determining if options have changed is okay however, as
// callback functions are not normally changed between renders.
if (!equal(
stripFns(newObservableQueryOptions),
stripFns(this.previousData.observableQueryOptions),
)) {
if (
!equal(
newObservableQueryOptions,
this.previousData.observableQueryOptions
)
) {
this.previousData.observableQueryOptions = newObservableQueryOptions;
this.currentObservable
.setOptions(newObservableQueryOptions)
Expand Down

0 comments on commit 18b0912

Please sign in to comment.