Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5fbbc78

Browse files
authoredApr 20, 2022
Fixes
1 parent 3fdd958 commit 5fbbc78

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

‎packages/plugins/graphql-jit/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ export const useGraphQlJit = (
7272
return compiledQuery;
7373
}
7474

75-
function execute(args: ExecutionArgs) {
75+
function jitExecute(args: ExecutionArgs) {
7676
const cacheEntry = getCacheEntry(args);
7777

7878
return cacheEntry.query(args.rootValue, args.contextValue, args.variableValues);
7979
}
8080

81-
function subscribe(args: ExecutionArgs) {
81+
function jitSubscribe(args: ExecutionArgs) {
8282
const cacheEntry = getCacheEntry(args);
8383

8484
return cacheEntry.subscribe
@@ -98,12 +98,12 @@ export const useGraphQlJit = (
9898
},
9999
async onExecute({ args, setExecuteFn }) {
100100
if (!pluginOptions.enableIf || (pluginOptions.enableIf && (await pluginOptions.enableIf(args)))) {
101-
setExecuteFn(execute);
101+
setExecuteFn(jitExecute);
102102
}
103103
},
104104
async onSubscribe({ args, setSubscribeFn }) {
105105
if (!pluginOptions.enableIf || (pluginOptions.enableIf && (await pluginOptions.enableIf(args)))) {
106-
setSubscribeFn(subscribe);
106+
setSubscribeFn(jitSubscribe);
107107
}
108108
},
109109
};

‎packages/plugins/graphql-jit/test/graphql-jit.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('useGraphQlJit', () => {
5252

5353
expect(onExecuteSpy).toHaveBeenCalledTimes(1);
5454
expect(onExecuteSpy.mock.calls[0][0].executeFn).not.toBe(execute);
55-
expect(onExecuteSpy.mock.calls[0][0].executeFn.name).toBe('jitExecutor');
55+
expect(onExecuteSpy.mock.calls[0][0].executeFn.name).toBe('jitExecute');
5656
});
5757

5858
it('Should override subscribe function', async () => {
@@ -72,7 +72,7 @@ describe('useGraphQlJit', () => {
7272

7373
expect(onSubscribeSpy).toHaveBeenCalledTimes(1);
7474
expect(onSubscribeSpy.mock.calls[0][0].subscribeFn).not.toBe(subscribe);
75-
expect(onSubscribeSpy.mock.calls[0][0].subscribeFn.name).toBe('jitSubscriber');
75+
expect(onSubscribeSpy.mock.calls[0][0].subscribeFn.name).toBe('jitSubscribe');
7676
});
7777

7878
it('Should not override execute function when enableIf returns false', async () => {
@@ -97,7 +97,7 @@ describe('useGraphQlJit', () => {
9797

9898
expect(onExecuteSpy).toHaveBeenCalledTimes(1);
9999
expect(onExecuteSpy.mock.calls[0][0].executeFn).toBe(execute);
100-
expect(onExecuteSpy.mock.calls[0][0].executeFn.name).not.toBe('jitExecutor');
100+
expect(onExecuteSpy.mock.calls[0][0].executeFn.name).not.toBe('jitExecute');
101101
});
102102

103103
it('Should not override subscribe function when enableIf returns false', async () => {
@@ -122,7 +122,7 @@ describe('useGraphQlJit', () => {
122122

123123
expect(onSubscribeSpy).toHaveBeenCalledTimes(1);
124124
expect(onSubscribeSpy.mock.calls[0][0].subscribeFn).toBe(subscribe);
125-
expect(onSubscribeSpy.mock.calls[0][0].subscribeFn.name).not.toBe('jitSubscriber');
125+
expect(onSubscribeSpy.mock.calls[0][0].subscribeFn.name).not.toBe('jitSubscribe');
126126
});
127127

128128
it('Should execute correctly', async () => {

0 commit comments

Comments
 (0)
Please sign in to comment.