TanStackT
TanStack2y ago
8 replies
radical-lime

Page not reloading

The route switches to the new gameserver whenever that route is not cached. When cached it does not switch.
I'm on wayland and my screen recording is a bit janky..

I looked at incorrect react-query cache, I see a cache for each gameserver,
I see cached matched route for the route that matches the gameserverId

It seems like the useParams update is slow? and when I select a new gameserver, the param is not updated, so the navigation is not triggered
If someone would have an idea of what's happening here, I'd much appreciate it...

keys:
export const installedModuleKeys = {
  all: ['installed modules'] as const,
  list: (gameServerId: string) => [...installedModuleKeys.all, 'list', gameServerId] as const,
  detail: (gameServerId: string, moduleId: string) =>
    [...installedModuleKeys.all, 'detail', gameServerId, moduleId] as const,
};


queryOptions:
export const gameServerModuleInstallationsOptions = (gameServerId: string) => {
  return queryOptions<ModuleInstallationOutputDTO[], AxiosError<ModuleInstallationOutputDTOAPI>>({
    queryKey: installedModuleKeys.list(gameServerId),
    queryFn: async () =>
      (await getApiClient().gameserver.gameServerControllerGetInstalledModules(gameServerId)).data.data,
  });
};
1708036897.gif
Was this page helpful?