diff --git a/apps/console/src/App.tsx b/apps/console/src/App.tsx index 02650e7c3..7e2c039b8 100644 --- a/apps/console/src/App.tsx +++ b/apps/console/src/App.tsx @@ -23,6 +23,7 @@ posthog.init(process.env.POSTHOG_KEY!, { const HomePage = lazy(() => import("./pages/HomePage")); const NotFoundPage = lazy(() => import("./pages/NotFoundPage")); const PeoplesPage = lazy(() => import("./pages/PeoplesPage")); +const VendorsPage = lazy(() => import("./pages/VendorsPage")); function App() { return ( @@ -37,6 +38,7 @@ function App() { }> } /> } /> + } /> } /> diff --git a/apps/console/src/pages/VendorsPage.tsx b/apps/console/src/pages/VendorsPage.tsx new file mode 100644 index 000000000..17ed62dc3 --- /dev/null +++ b/apps/console/src/pages/VendorsPage.tsx @@ -0,0 +1,61 @@ +import { Suspense, useEffect } from "react"; +import { + graphql, + PreloadedQuery, + usePreloadedQuery, + useQueryLoader, +} from "react-relay"; +import type { VendorsPageQuery as VendorsPageQueryType } from "./__generated__/VendorsPageQuery.graphql"; + +const VendorsPageQuery = graphql` + query VendorsPageQuery { + node(id: "AZSfP_xAcAC5IAAAAAAltA") { + id + ... on Organization { + vendors { + edges { + node { + id + name + createdAt + updatedAt + } + } + } + } + } + } +`; + +function VendorsPageContent({ + queryRef, +}: { + queryRef: PreloadedQuery; +}) { + const data = usePreloadedQuery(VendorsPageQuery, queryRef); + return ( +
{JSON.stringify(data, null, 2)}
+ ); +} + +function VendorsPageFallback() { + return
Loading...
; +} + +export default function VendorsPage() { + const [queryRef, loadQuery] = useQueryLoader(VendorsPageQuery); + + useEffect(() => { + loadQuery({}); + }, [loadQuery]); + + if (!queryRef) { + return ; + } + + return ( + }> + + + ); +}