chore: using refetchQueries instead of invalidateQueries

This commit is contained in:
d-kimsuon
2025-10-15 03:47:09 +09:00
parent d322db543c
commit f34943c9cc
3 changed files with 5 additions and 7 deletions

View File

@@ -47,7 +47,7 @@ export const ProjectPageContent = ({ projectId }: { projectId: string }) => {
// biome-ignore lint/correctness/useExhaustiveDependencies: invalidate when config changed // biome-ignore lint/correctness/useExhaustiveDependencies: invalidate when config changed
useEffect(() => { useEffect(() => {
void queryClient.invalidateQueries({ void queryClient.refetchQueries({
queryKey: ["projects", projectId], queryKey: ["projects", projectId],
}); });
}, [config.hideNoUserMessageSession, config.unifySameTitleSession]); }, [config.hideNoUserMessageSession, config.unifySameTitleSession]);

View File

@@ -37,13 +37,13 @@ export const SettingsControls: FC<SettingsControlsProps> = ({
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const onConfigChanged = useCallback(async () => { const onConfigChanged = useCallback(async () => {
await queryClient.invalidateQueries({ await queryClient.refetchQueries({
queryKey: configQuery.queryKey, queryKey: configQuery.queryKey,
}); });
await queryClient.invalidateQueries({ await queryClient.refetchQueries({
queryKey: projectListQuery.queryKey, queryKey: projectListQuery.queryKey,
}); });
void queryClient.invalidateQueries({ void queryClient.refetchQueries({
queryKey: projectDetailQuery(openingProjectId).queryKey, queryKey: projectDetailQuery(openingProjectId).queryKey,
}); });
}, [queryClient, openingProjectId]); }, [queryClient, openingProjectId]);

View File

@@ -18,9 +18,7 @@ export const projectListQuery = {
export const projectDetailQuery = (projectId: string, cursor?: string) => export const projectDetailQuery = (projectId: string, cursor?: string) =>
({ ({
queryKey: cursor queryKey: ["projects", projectId],
? ["projects", projectId, cursor]
: ["projects", projectId],
queryFn: async () => { queryFn: async () => {
const response = await honoClient.api.projects[":projectId"].$get({ const response = await honoClient.api.projects[":projectId"].$get({
param: { projectId }, param: { projectId },