This commit is contained in:
Mihovil Ilakovac 2024-11-26 16:13:05 +01:00
parent 67de09345d
commit ee7c6dec2f
4 changed files with 2 additions and 7 deletions

View File

@ -23,8 +23,6 @@ function createUserGetter(): Query<void, AuthUser | null> {
try { try {
const response = await api.get(getMeRoute.path) const response = await api.get(getMeRoute.path)
const userData = superjsonDeserialize<AuthUserData | null>(response.data) const userData = superjsonDeserialize<AuthUserData | null>(response.data)
// TODO: figure out why overloading is not working
// @ts-ignore
return makeAuthUserIfPossible(userData) return makeAuthUserIfPossible(userData)
} catch (error) { } catch (error) {
if (error.response?.status === 401) { if (error.response?.status === 401) {

View File

@ -211,11 +211,9 @@ function makeOptimisticUpdateMutationFn<Input, Output, CachedData>(
return (function performActionWithOptimisticUpdates(item: Input) { return (function performActionWithOptimisticUpdates(item: Input) {
const specificOptimisticUpdateDefinitions = optimisticUpdateDefinitions.map( const specificOptimisticUpdateDefinitions = optimisticUpdateDefinitions.map(
(generalDefinition) => (generalDefinition) =>
// @ts-ignore
getOptimisticUpdateDefinitionForSpecificItem(generalDefinition, item) getOptimisticUpdateDefinitionForSpecificItem(generalDefinition, item)
); );
return (actionFn as InternalAction<Input, Output>).internal( return (actionFn as InternalAction<Input, Output>).internal(
// @ts-ignore
item, item,
specificOptimisticUpdateDefinitions specificOptimisticUpdateDefinitions
); );
@ -273,7 +271,6 @@ function makeRqOptimisticUpdateOptions<ActionInput, CachedData>(
// Attempt to optimistically update the cache using the new value. // Attempt to optimistically update the cache using the new value.
try { try {
// @ts-ignore
queryClient.setQueryData(queryKey, updateQuery); queryClient.setQueryData(queryKey, updateQuery);
} catch (e) { } catch (e) {
console.error( console.error(

View File

@ -18,7 +18,7 @@ import {
// Details here: https://github.com/wasp-lang/wasp/issues/2017 // Details here: https://github.com/wasp-lang/wasp/issues/2017
export function makeQueryCacheKey<Input, Output>( export function makeQueryCacheKey<Input, Output>(
query: Query<Input, Output>, query: Query<Input, Output>,
payload?: Input payload: Input
): (string | Input)[] { ): (string | Input)[] {
return payload !== undefined ? return payload !== undefined ?
[...query.queryCacheKey, payload] [...query.queryCacheKey, payload]

View File

@ -93,4 +93,4 @@ type ClientOperationWithNonAnyInput<Input, Output> =
? (args?: unknown) => Promise<Output> ? (args?: unknown) => Promise<Output>
: [Input] extends [void] : [Input] extends [void]
? () => Promise<Output> ? () => Promise<Output>
: (args?: Input) => Promise<Output> : (args: Input) => Promise<Output>