From 5bcd14fd11ec614da3c2b266b6e14df561107a63 Mon Sep 17 00:00:00 2001 From: bill Date: Tue, 29 Oct 2024 16:54:17 +0800 Subject: [PATCH] feat: To make the project build successfully, remove no-store from the request.ts file #1841 --- .../database/[databaseId]/table/[tableId]/indexes.tsx | 7 ++----- .../database/[databaseId]/table/[tableId]/page.tsx | 7 +++++-- .../database/[databaseId]/table/[tableId]/segments.tsx | 4 ++-- .../[databaseId]/table/[tableId]/table-columns.tsx | 7 ++----- gui/app/(dashboard)/database/hooks.ts | 8 ++++---- gui/app/(dashboard)/database/interface.ts | 9 +++++++-- gui/app/(dashboard)/databases/page.tsx | 4 +--- gui/app/(dashboard)/system/page.tsx | 6 +----- gui/app/(dashboard)/tables/page.tsx | 6 ++---- gui/lib/request.ts | 1 - 10 files changed, 26 insertions(+), 33 deletions(-) diff --git a/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/indexes.tsx b/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/indexes.tsx index 1b90a36c99..cfb01b099c 100644 --- a/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/indexes.tsx +++ b/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/indexes.tsx @@ -4,7 +4,7 @@ import { ITableIndex } from '@/lib/databse-interface'; import { ColumnDef } from '@tanstack/react-table'; import { useFetchTableIndexes } from 'app/(dashboard)/database/hooks'; import { DataTable } from 'app/(dashboard)/database/infinity-table'; -import { DatabaseRouteParams } from 'app/(dashboard)/database/interface'; +import { PureDatabaseRouteParams } from 'app/(dashboard)/database/interface'; export const columns: ColumnDef[] = [ { @@ -21,10 +21,7 @@ export const columns: ColumnDef[] = [ } ]; -export function TableIndexes({ - tableId, - databaseId -}: DatabaseRouteParams['params']) { +export function TableIndexes({ tableId, databaseId }: PureDatabaseRouteParams) { const { tableIndexes } = useFetchTableIndexes({ tableId, databaseId }); return ( diff --git a/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/page.tsx b/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/page.tsx index 967f685a87..f0173df31a 100644 --- a/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/page.tsx +++ b/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/page.tsx @@ -1,5 +1,8 @@ import { Leaf } from 'app/(dashboard)/database/constants'; -import { DatabaseRouteParams } from 'app/(dashboard)/database/interface'; +import { + DatabaseRouteParams, + PureDatabaseRouteParams +} from 'app/(dashboard)/database/interface'; import React from 'react'; // import { TableColumns } from './columns'; import { TableIndexes } from './indexes'; @@ -25,7 +28,7 @@ export default async function DatabasePage(props: DatabaseRouteParams) { const { tab } = searchParams; - const DatabaseTable: React.FunctionComponent = + const DatabaseTable: React.FunctionComponent = TableMap[tab] ?? Empty; return ( diff --git a/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/segments.tsx b/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/segments.tsx index 0c0ce871ab..294ba17456 100644 --- a/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/segments.tsx +++ b/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/segments.tsx @@ -4,7 +4,7 @@ import { ITableSegment } from '@/lib/databse-interface'; import { ColumnDef } from '@tanstack/react-table'; import { useFetchTableSegments } from 'app/(dashboard)/database/hooks'; import { DataTable } from 'app/(dashboard)/database/infinity-table'; -import { DatabaseRouteParams } from 'app/(dashboard)/database/interface'; +import { PureDatabaseRouteParams } from 'app/(dashboard)/database/interface'; export const columns: ColumnDef[] = [ { @@ -24,7 +24,7 @@ export const columns: ColumnDef[] = [ export function TableSegments({ tableId, databaseId -}: DatabaseRouteParams['params']) { +}: PureDatabaseRouteParams) { const { tableSegments } = useFetchTableSegments({ tableId, databaseId }); return ( diff --git a/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/table-columns.tsx b/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/table-columns.tsx index 066d8ae7cd..f36d941846 100644 --- a/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/table-columns.tsx +++ b/gui/app/(dashboard)/database/[databaseId]/table/[tableId]/table-columns.tsx @@ -4,7 +4,7 @@ import { ITableColumns } from '@/lib/databse-interface'; import { ColumnDef } from '@tanstack/react-table'; import { useFetchTableColumns } from 'app/(dashboard)/database/hooks'; import { DataTable } from 'app/(dashboard)/database/infinity-table'; -import { DatabaseRouteParams } from 'app/(dashboard)/database/interface'; +import { PureDatabaseRouteParams } from 'app/(dashboard)/database/interface'; import { DataTableColumnHeader } from 'app/(dashboard)/database/table-column-header'; export const columns: ColumnDef[] = [ @@ -31,10 +31,7 @@ export const columns: ColumnDef[] = [ } ]; -export function TableColumns({ - tableId, - databaseId -}: DatabaseRouteParams['params']) { +export function TableColumns({ tableId, databaseId }: PureDatabaseRouteParams) { const { tableColumns } = useFetchTableColumns({ tableId, databaseId }); return ( diff --git a/gui/app/(dashboard)/database/hooks.ts b/gui/app/(dashboard)/database/hooks.ts index 80a9f56b46..b73eb10113 100644 --- a/gui/app/(dashboard)/database/hooks.ts +++ b/gui/app/(dashboard)/database/hooks.ts @@ -13,7 +13,7 @@ import { showTableIndexes, showTableSegments } from '../actions'; -import { DatabaseRouteParams, TreeParentId } from './interface'; +import { PureDatabaseRouteParams, TreeParentId } from './interface'; import { buildLeafData, getParentIdById, updateTreeData } from './utils'; export const useHandleClickTreeName = () => { @@ -186,7 +186,7 @@ export const useBuildTreeData = () => { export const useFetchTableColumns = ({ databaseId, tableId -}: DatabaseRouteParams['params']) => { +}: PureDatabaseRouteParams) => { const [tableColumns, setTableColumns] = useState([]); const fetchTableColumns = useCallback(async () => { @@ -208,7 +208,7 @@ export const useFetchTableColumns = ({ export const useFetchTableIndexes = ({ databaseId, tableId -}: DatabaseRouteParams['params']) => { +}: PureDatabaseRouteParams) => { const [tableIndexes, setTableIndexes] = useState([]); const fetchTableIndexes = useCallback(async () => { @@ -230,7 +230,7 @@ export const useFetchTableIndexes = ({ export const useFetchTableSegments = ({ databaseId, tableId -}: DatabaseRouteParams['params']) => { +}: PureDatabaseRouteParams) => { const [tableSegments, setTableSegments] = useState([]); const fetchTableSegments = useCallback(async () => { diff --git a/gui/app/(dashboard)/database/interface.ts b/gui/app/(dashboard)/database/interface.ts index 06a01b4bc4..e19e6be582 100644 --- a/gui/app/(dashboard)/database/interface.ts +++ b/gui/app/(dashboard)/database/interface.ts @@ -2,7 +2,12 @@ import { Leaf } from './constants'; export type TreeParentId = string | number | null; +export interface PureDatabaseRouteParams { + databaseId: string; + tableId: string; +} + export interface DatabaseRouteParams { - params: { databaseId: string; tableId: string }; - searchParams: { tab: Leaf }; + params: Promise; + searchParams: Promise<{ tab: Leaf }>; } diff --git a/gui/app/(dashboard)/databases/page.tsx b/gui/app/(dashboard)/databases/page.tsx index ca7e4ab375..0753f75ecb 100644 --- a/gui/app/(dashboard)/databases/page.tsx +++ b/gui/app/(dashboard)/databases/page.tsx @@ -5,9 +5,7 @@ import { listDatabase } from '../actions'; import { DatabaseCard } from '../database-card'; import { DatabaseCreatingDialog } from '../database-creating-dialog'; -export default async function HomePage({}: { - searchParams: { q: string; offset: string }; -}) { +export default async function HomePage() { const ret = await listDatabase(); return ( diff --git a/gui/app/(dashboard)/system/page.tsx b/gui/app/(dashboard)/system/page.tsx index 4639761731..1e5afd5ede 100644 --- a/gui/app/(dashboard)/system/page.tsx +++ b/gui/app/(dashboard)/system/page.tsx @@ -6,14 +6,10 @@ import { CardTitle } from '@/components/ui/card'; import { showConfigs, showVariables } from '../actions'; -// import { getProducts } from '@/lib/db'; -export default async function ProductsPage({}: { - searchParams: { q: string; offset: string }; -}) { +export default async function ProductsPage() { const configs = await showConfigs(); const variables = await showVariables(); - console.log(variables); return (
diff --git a/gui/app/(dashboard)/tables/page.tsx b/gui/app/(dashboard)/tables/page.tsx index 8ca62edc8a..fbf67bb912 100644 --- a/gui/app/(dashboard)/tables/page.tsx +++ b/gui/app/(dashboard)/tables/page.tsx @@ -20,7 +20,7 @@ async function InfinityTable() { - {tables.tables.map((table: string) => ( + {tables.tables?.map((table: string) => ( {table} @@ -30,9 +30,7 @@ async function InfinityTable() { ); } -export default async function DatabasePage({}: { - searchParams: { q: string; offset: string }; -}) { +export default async function DatabasePage() { const items: MenuItem[] = [ { key: 'sub1', diff --git a/gui/lib/request.ts b/gui/lib/request.ts index 2e158a8e37..95bb8c6ad6 100644 --- a/gui/lib/request.ts +++ b/gui/lib/request.ts @@ -10,7 +10,6 @@ export const request = async ( headers: { accept: 'application/json' }, - cache: 'no-store', method };