Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Remove onError and onCompleted from memoized options #3419

Merged
merged 14 commits into from Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -92,7 +92,7 @@
{
"name": "@apollo/react-hooks",
"path": "./packages/hooks/lib/react-hooks.cjs.min.js",
"maxSize": "4 kB"
"maxSize": "4.01 kB"
},
{
"name": "@apollo/react-ssr",
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/__tests__/useQuery.test.tsx
Expand Up @@ -402,7 +402,7 @@ describe('useQuery Hook', () => {
let renderCount = 0;
function App() {
const [_, forceUpdate] = useReducer(x => x + 1, 0);
const { loading, error } = useQuery(query);
const { loading, error } = useQuery(query, { onError: () => { }, onCompleted: () => { } });

switch (renderCount) {
case 0:
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/utils/useBaseQuery.ts
Expand Up @@ -30,7 +30,7 @@ export function useBaseQuery<TData = any, TVariables = OperationVariables>(
queryData.context = context;

const memo = {
options: updatedOptions,
options: { ...updatedOptions, onError: undefined, onCompleted: undefined },
context,
tick
};
Expand Down