#Error with search param and router not matching

2 messages · Page 1 of 1 (latest)

native stag
#
const overviewSearchParam = z.object({
    startDate: fallback(
        z.coerce.date(),
        new Date(Date.now() - 30 * 24 * 60 * 60 * 1000),
    ),
    endDate: fallback(z.coerce.date(), new Date()).default(new Date()),
});

export const Route = createFileRoute(
    "/_dashboard-layout-id/dashboard/overview",
)({
    validateSearch: zodValidator(overviewSearchParam),
  loaderDeps: ({search: {startDate, endDate}}) => ({startDate, endDate}),
  loader: async ({context: {queryClient}, deps: {startDate, endDate}}) => {
    queryClient.ensureQueryData(getArtistDashboardStatsQueryOptions({startDate, endDate}));
  },
    component: RouteComponent,
});```
bitter hedge
#

please provide a complete minimal example