mirror of
https://github.com/aljazceru/claude-code-viewer.git
synced 2026-01-08 08:04:23 +01:00
fix: bug fix session list doesn't updated after filter config changed
This commit is contained in:
@@ -1,40 +1,47 @@
|
||||
"use client";
|
||||
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { type FC, useId } from "react";
|
||||
import { type FC, useCallback, useId } from "react";
|
||||
import { configQueryConfig, useConfig } from "@/app/hooks/useConfig";
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { projectQueryConfig } from "../app/projects/[projectId]/hooks/useProject";
|
||||
|
||||
interface SettingsControlsProps {
|
||||
openingProjectId: string;
|
||||
showLabels?: boolean;
|
||||
showDescriptions?: boolean;
|
||||
className?: string;
|
||||
onConfigChange?: () => void;
|
||||
}
|
||||
|
||||
export const SettingsControls: FC<SettingsControlsProps> = ({
|
||||
openingProjectId,
|
||||
showLabels = true,
|
||||
showDescriptions = true,
|
||||
className = "",
|
||||
onConfigChange,
|
||||
}: SettingsControlsProps) => {
|
||||
const checkboxId = useId();
|
||||
const { config, updateConfig } = useConfig();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const onConfigChanged = useCallback(async () => {
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: configQueryConfig.queryKey,
|
||||
});
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: ["projects"],
|
||||
});
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: projectQueryConfig(openingProjectId).queryKey,
|
||||
});
|
||||
}, [queryClient, openingProjectId]);
|
||||
|
||||
const handleHideNoUserMessageChange = async () => {
|
||||
const newConfig = {
|
||||
...config,
|
||||
hideNoUserMessageSession: !config?.hideNoUserMessageSession,
|
||||
};
|
||||
updateConfig(newConfig);
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: configQueryConfig.queryKey,
|
||||
});
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: ["projects"],
|
||||
});
|
||||
onConfigChange?.();
|
||||
await onConfigChanged();
|
||||
};
|
||||
|
||||
const handleUnifySameTitleChange = async () => {
|
||||
@@ -43,13 +50,7 @@ export const SettingsControls: FC<SettingsControlsProps> = ({
|
||||
unifySameTitleSession: !config?.unifySameTitleSession,
|
||||
};
|
||||
updateConfig(newConfig);
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: configQueryConfig.queryKey,
|
||||
});
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: ["projects"],
|
||||
});
|
||||
onConfigChange?.();
|
||||
await onConfigChanged();
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user