mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-01 20:03:30 +02:00
refactor: migrate dashboard-breadcrumb to useQuery and remove obvious comments
This commit is contained in:
parent
1172a91a07
commit
291bb0369a
2 changed files with 7 additions and 6 deletions
|
|
@ -52,7 +52,6 @@ export function SourceDetailSheet({
|
|||
const highlightedChunkRef = useRef<HTMLDivElement>(null);
|
||||
const [summaryOpen, setSummaryOpen] = useState(false);
|
||||
|
||||
// Add useQuery to fetch document by chunk
|
||||
const {
|
||||
data: document,
|
||||
isLoading: isDocumentByChunkFetching,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ import {
|
|||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from "@/components/ui/breadcrumb";
|
||||
import { useSearchSpace } from "@/hooks/use-search-space";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
|
||||
import { cacheKeys } from "@/lib/query-client/cache-keys";
|
||||
import { authenticatedFetch, getBearerToken } from "@/lib/auth-utils";
|
||||
|
||||
interface BreadcrumbItemInterface {
|
||||
|
|
@ -29,10 +31,10 @@ export function DashboardBreadcrumb() {
|
|||
const segments = pathname.split("/").filter(Boolean);
|
||||
const searchSpaceId = segments[0] === "dashboard" && segments[1] ? segments[1] : null;
|
||||
|
||||
// Fetch search space details if we have an ID
|
||||
const { searchSpace } = useSearchSpace({
|
||||
searchSpaceId: searchSpaceId || "",
|
||||
autoFetch: !!searchSpaceId,
|
||||
const { data: searchSpace } = useQuery({
|
||||
queryKey: cacheKeys.searchSpaces.detail(searchSpaceId || ""),
|
||||
queryFn: () => searchSpacesApiService.getSearchSpace({ id: Number(searchSpaceId) }),
|
||||
enabled: !!searchSpaceId,
|
||||
});
|
||||
|
||||
// State to store document title for editor breadcrumb
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue