TanStackT
TanStack3y ago
3 replies
dry-scarlet

Simple Example Using Navigate And Search Params

Given a validateSearch object like this:
  validateSearch: () => z.object({
    stopRedirect: z.boolean().optional()
  }),

How should I call navigate?
Calling navigate like so:
            navigate({
                ....
                search: {
                    stopRedirect: false,
                },
            })

gives an errors saying: Type '{ shouldRedirect: false; }' is not assignable to type 'SearchReducer...

Following the Code Sandbox more closely, I try this:
                search: (old) => {
                    return {
                        ...old,
                        stopRedirect: true,
                    }
                },

I get an error saying:
Type 'undefined' is not assignable to type '() => { shape: { stopRedirect: ZodOptional<ZodBoolean>; }; keys: string[]; }'.
Was this page helpful?