import { useQuery } from "urql"; import { useLocation, useSearch } from "wouter"; import { GetFeedsDocument } from "../graphql/generated/graphql"; interface Props { basePath: string; } const urqlContextFeed = { additionalTypenames: ["Feed", "Article"] }; export function FeedSidebar({ basePath }: Props) { const search = useSearch(); const [, setLocation] = useLocation(); const params = new URLSearchParams(search); const selectedFeedId = params.get("feed"); const [{ data, fetching }] = useQuery({ query: GetFeedsDocument, context: urqlContextFeed, }); const handleSelect = (feedId: string | null) => { if (feedId) { setLocation(`${basePath}?feed=${feedId}`); } else { setLocation(basePath); } }; return ( ); }