Skip to content

Commit 13d295a

Browse files
RaghavendraTirumalasettijustinconabreeglo82145
authored
Fixing issue with apollo error due to undefined query, changing test to non-deprecated flag (#4084)
Co-authored-by: Justin Conabree <[email protected]> Co-authored-by: Aanchal Pawar <[email protected]>
1 parent d73a6e9 commit 13d295a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

packages/peregrine/lib/talons/Link/__tests__/useLink.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const givenEmptyProps = () => {
7676

7777
const givenValidProps = () => {
7878
props = {
79-
prefetchType: true,
79+
shouldPrefetch: true,
8080
innerRef: { current: 'foo' },
8181
to: '/bar.html'
8282
};
@@ -86,7 +86,7 @@ const givenFalsePrefetch = () => {
8686
givenValidProps();
8787
props = {
8888
...props,
89-
prefetchType: false
89+
shouldPrefetch: false
9090
};
9191
};
9292

@@ -175,7 +175,7 @@ describe('#useLink does not run query when', () => {
175175
expect(mockRunQuery).not.toHaveBeenCalled();
176176
});
177177

178-
test('should prefetch is false', async () => {
178+
test('prefetch flag is false', async () => {
179179
givenFalsePrefetch();
180180

181181
await act(() => {

packages/peregrine/lib/talons/Link/useLink.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import DEFAULT_OPERATIONS from '../MagentoRoute/magentoRoute.gql';
88
export const useLink = (props, passedOperations = {}) => {
99
const { innerRef: originalRef, to } = props;
1010
const shouldPrefetch = props.prefetchType || props.shouldPrefetch;
11-
const operations = shouldPrefetch
12-
? mergeOperations(DEFAULT_OPERATIONS, passedOperations)
13-
: {};
11+
const operations = mergeOperations(DEFAULT_OPERATIONS, passedOperations);
1412

1513
const intersectionObserver = useIntersectionObserver();
1614
const { resolveUrlQuery } = operations;

0 commit comments

Comments
 (0)