Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
fix schema browser not subscribing to query client
Browse files Browse the repository at this point in the history
  • Loading branch information
xx-db committed Aug 8, 2024
1 parent dd4f528 commit 27048a3
Showing 1 changed file with 72 additions and 87 deletions.
159 changes: 72 additions & 87 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,128 +23,113 @@ const router = createBrowserRouter([
children: [
{
path: '/',
Component() {
return <CatalogsList />;
},
element: <CatalogsList />,
},
{
path: '/data/:catalog',
Component() {
return <CatalogDetails />;
},
element: <CatalogDetails />,
},
{
path: '/data/:catalog/:schema',
Component() {
return <SchemaDetails />;
},
element: <SchemaDetails />,
},
{
path: '/data/:catalog/:schema/:table',
Component() {
return <TableDetails />;
},
element: <TableDetails />,
},
{
path: '/volumes/:catalog/:schema/:volume',
Component() {
return <VolumeDetails />;
},
element: <VolumeDetails />,
},
{
path: '/functions/:catalog/:schema/:ucFunction',
Component() {
return <FunctionDetails />;
},
element: <FunctionDetails />,
},
],
},
]);

function AppProvider() {
const navigate = useNavigate();
const queryClient = new QueryClient({
defaultOptions: { queries: { staleTime: 1000 * 5 * 60 } },
});

return (
<QueryClientProvider client={queryClient}>
<ConfigProvider
theme={{
components: {
Typography: {
titleMarginBottom: 0,
titleMarginTop: 0,
},
<ConfigProvider
theme={{
components: {
Typography: {
titleMarginBottom: 0,
titleMarginTop: 0,
},
}}
>
<Layout>
{/* Header */}
<Layout.Header style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ marginRight: 24 }} onClick={() => navigate('/')}>
<img
src="/uc-logo-reverse.png"
height={32}
alt="uc-logo-reverse"
/>
</div>
<Menu
theme="dark"
mode="horizontal"
defaultSelectedKeys={['catalogs']}
items={[
{
key: 'catalogs',
label: 'Catalogs',
onClick: () => navigate('/'),
},
]}
style={{ flex: 1, minWidth: 0 }}
/>
</Layout.Header>
{/* Content */}
<Layout.Content
},
}}
>
<Layout>
{/* Header */}
<Layout.Header style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ marginRight: 24 }} onClick={() => navigate('/')}>
<img src="/uc-logo-reverse.png" height={32} alt="uc-logo-reverse" />
</div>
<Menu
theme="dark"
mode="horizontal"
defaultSelectedKeys={['catalogs']}
items={[
{
key: 'catalogs',
label: 'Catalogs',
onClick: () => navigate('/'),
},
]}
style={{ flex: 1, minWidth: 0 }}
/>
</Layout.Header>
{/* Content */}
<Layout.Content
style={{
height: 'calc(100vh - 64px)',
backgroundColor: '#fff',
display: 'flex',
}}
>
{/* Left: Schema Browser */}
<div
style={{
height: 'calc(100vh - 64px)',
backgroundColor: '#fff',
display: 'flex',
width: '30%',
minWidth: 260,
maxWidth: 400,
borderRight: '1px solid lightgrey',
}}
>
{/* Left: Schema Browser */}
<div
style={{
width: '30%',
minWidth: 260,
maxWidth: 400,
borderRight: '1px solid lightgrey',
}}
>
<SchemaBrowser />
</div>
<SchemaBrowser />
</div>

{/* Right: Main details content */}
<div
style={{
overflowY: 'auto',
flex: 1,
padding: 16,
display: 'flex',
}}
>
<Outlet />
</div>
</Layout.Content>
</Layout>
</ConfigProvider>
</QueryClientProvider>
{/* Right: Main details content */}
<div
style={{
overflowY: 'auto',
flex: 1,
padding: 16,
display: 'flex',
}}
>
<Outlet />
</div>
</Layout.Content>
</Layout>
</ConfigProvider>
);
}

function App() {
const queryClient = new QueryClient({
defaultOptions: { queries: { staleTime: 1000 * 5 * 60 } },
});

return (
<NotificationProvider>
<RouterProvider router={router} fallbackElement={<p>Loading...</p>} />
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} fallbackElement={<p>Loading...</p>} />
</QueryClientProvider>
</NotificationProvider>
);
}
Expand Down

0 comments on commit 27048a3

Please sign in to comment.