graphql-codegen-plugin-typescript-swr 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +2 -2
- package/build/tsconfig.main.tsbuildinfo +1 -1
- package/build/tsconfig.module.tsbuildinfo +1 -1
- package/jest.config.js +1 -1
- package/package.json +7 -7
- package/src/visitor.ts +4 -2
- package/tests/outputs/autogenSWRKey.ts +1 -1
- package/yarn.lock +1842 -1793
- package/.idea/.gitignore +0 -5
- package/.idea/codeStyles/Project.xml +0 -63
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/graphql-codegen-plugin-typescript-swr.iml +0 -12
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -134
- package/package-lock.json +0 -14306
package/src/visitor.ts
CHANGED
|
@@ -219,8 +219,10 @@ export class SWRVisitor extends ClientSideBaseVisitor<
|
|
|
219
219
|
if (this._enabledInfinite) {
|
|
220
220
|
codes.push(` const utilsForInfinite = {
|
|
221
221
|
generateGetKey: <Data = unknown, Variables = unknown>(
|
|
222
|
-
id: string,
|
|
223
|
-
getKey: ${config.typesPrefix}SWRInfiniteKeyLoader${
|
|
222
|
+
id: ${config.autogenSWRKey ? 'SWRKeyInterface' : 'string'},
|
|
223
|
+
getKey: ${config.typesPrefix}SWRInfiniteKeyLoader${
|
|
224
|
+
config.typesSuffix
|
|
225
|
+
}<Data, Variables>
|
|
224
226
|
) => (pageIndex: number, previousData: Data | null) => {
|
|
225
227
|
const key = getKey(pageIndex, previousData)
|
|
226
228
|
return key ? [id, ...key] : null
|
|
@@ -2,7 +2,7 @@ export function getSdkWithHooks(client: GraphQLClient, withWrapper: SdkFunctionW
|
|
|
2
2
|
const sdk = getSdk(client, withWrapper);
|
|
3
3
|
const utilsForInfinite = {
|
|
4
4
|
generateGetKey: <Data = unknown, Variables = unknown>(
|
|
5
|
-
id:
|
|
5
|
+
id: SWRKeyInterface,
|
|
6
6
|
getKey: SWRInfiniteKeyLoader<Data, Variables>
|
|
7
7
|
) => (pageIndex: number, previousData: Data | null) => {
|
|
8
8
|
const key = getKey(pageIndex, previousData)
|