mirror of
https://github.com/aljazceru/claude-code-viewer.git
synced 2025-12-25 09:14:22 +01:00
fix: bug fix session list doesn't updated after filter config changed
This commit is contained in:
@@ -45,12 +45,6 @@ export const ProjectPageContent = ({ projectId }: { projectId: string }) => {
|
||||
});
|
||||
}, [config.hideNoUserMessageSession, config.unifySameTitleSession]);
|
||||
|
||||
const handleConfigChange = () => {
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: projectQueryConfig(projectId).queryKey,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="container mx-auto px-2 sm:px-4 py-4 sm:py-8 max-w-6xl">
|
||||
<header className="mb-6 sm:mb-8">
|
||||
@@ -118,7 +112,7 @@ export const ProjectPageContent = ({ projectId }: { projectId: string }) => {
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<div className="p-4 bg-muted/50 rounded-lg border">
|
||||
<SettingsControls onConfigChange={handleConfigChange} />
|
||||
<SettingsControls openingProjectId={projectId} />
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</div>
|
||||
|
||||
@@ -79,7 +79,7 @@ export const MobileSidebar: FC<MobileSidebarProps> = ({
|
||||
case "mcp":
|
||||
return <McpTab />;
|
||||
case "settings":
|
||||
return <SettingsTab />;
|
||||
return <SettingsTab openingProjectId={projectId} />;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export const SessionSidebar: FC<{
|
||||
case "mcp":
|
||||
return <McpTab />;
|
||||
case "settings":
|
||||
return <SettingsTab />;
|
||||
return <SettingsTab openingProjectId={projectId} />;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
import type { FC } from "react";
|
||||
import { SettingsControls } from "@/components/SettingsControls";
|
||||
|
||||
export const SettingsTab: FC = () => {
|
||||
export const SettingsTab: FC<{
|
||||
openingProjectId: string;
|
||||
}> = ({ openingProjectId }) => {
|
||||
return (
|
||||
<div className="h-full flex flex-col">
|
||||
<div className="border-b border-sidebar-border p-4">
|
||||
@@ -20,7 +22,7 @@ export const SettingsTab: FC = () => {
|
||||
Session Display
|
||||
</h3>
|
||||
|
||||
<SettingsControls />
|
||||
<SettingsControls openingProjectId={openingProjectId} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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