Skip to content

Commit 79e9181

Browse files
committed
fix: handle GET ops that aren't prefixed with 'get'
1 parent c5f955e commit 79e9181

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/name-helpers.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,17 @@ export function buildHookName(
4545
const name = method.name.value;
4646
const httpMethod = getHttpMethodByName(service, name);
4747

48-
if (
49-
httpMethod?.verb.value === 'get' &&
50-
name.toLocaleLowerCase().startsWith('get')
51-
) {
48+
if (httpMethod?.verb.value === 'get') {
5249
// Query Hook
50+
// Remove 'get' prefix if present for cleaner hook names
51+
const hookBaseName = name.toLocaleLowerCase().startsWith('get')
52+
? name.slice(3)
53+
: name;
54+
5355
return camel(
5456
`use_${options?.suspense ? 'suspense_' : ''}${
5557
options?.infinite ? 'infinite_' : ''
56-
}${name.slice(3)}`,
58+
}${hookBaseName}`,
5759
);
5860
}
5961

src/snapshot/v1/hooks/auth-permutations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function useAllAuthSchemes(
8181
}
8282

8383
/** @deprecated Use allAuthSchemesQueryOptions with useSuspenseQuery instead */
84-
export function useAllAuthSchemes(
84+
export function useSuspenseAllAuthSchemes(
8585
options?: Omit<
8686
UndefinedInitialDataOptions<void, QueryError<Error[]>, void>,
8787
'queryKey' | 'queryFn' | 'select'

src/snapshot/v1/hooks/exhaustives.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function useExhaustiveFormats(
8585
}
8686

8787
/** @deprecated Use exhaustiveFormatsQueryOptions with useSuspenseQuery instead */
88-
export function useExhaustiveFormats(
88+
export function useSuspenseExhaustiveFormats(
8989
params?: ExhaustiveFormatsParams,
9090
options?: Omit<
9191
UndefinedInitialDataOptions<void, QueryError<Error[]>, void>,
@@ -109,7 +109,7 @@ export function useExhaustiveParams(
109109
}
110110

111111
/** @deprecated Use exhaustiveParamsQueryOptions with useSuspenseQuery instead */
112-
export function useExhaustiveParams(
112+
export function useSuspenseExhaustiveParams(
113113
params: ExhaustiveParamsParams,
114114
options?: Omit<
115115
UndefinedInitialDataOptions<void, QueryError<Error[]>, void>,

0 commit comments

Comments
 (0)