Skip to content

Commit

Permalink
feat: To make the project build successfully, remove no-store from th…
Browse files Browse the repository at this point in the history
…e request.ts file #1841 (#2125)

### What problem does this PR solve?

feat: To make the project build successfully, remove no-store from the
request.ts file #1841


### Type of change

- [x] New Feature (non-breaking change which adds functionality)
  • Loading branch information
cike8899 authored Oct 29, 2024
1 parent 71cbee8 commit 7655e17
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ITableIndex>[] = [
{
Expand All @@ -21,10 +21,7 @@ export const columns: ColumnDef<ITableIndex>[] = [
}
];

export function TableIndexes({
tableId,
databaseId
}: DatabaseRouteParams['params']) {
export function TableIndexes({ tableId, databaseId }: PureDatabaseRouteParams) {
const { tableIndexes } = useFetchTableIndexes({ tableId, databaseId });

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -25,7 +28,7 @@ export default async function DatabasePage(props: DatabaseRouteParams) {

const { tab } = searchParams;

const DatabaseTable: React.FunctionComponent<DatabaseRouteParams['params']> =
const DatabaseTable: React.FunctionComponent<PureDatabaseRouteParams> =
TableMap[tab] ?? Empty;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ITableSegment>[] = [
{
Expand All @@ -24,7 +24,7 @@ export const columns: ColumnDef<ITableSegment>[] = [
export function TableSegments({
tableId,
databaseId
}: DatabaseRouteParams['params']) {
}: PureDatabaseRouteParams) {
const { tableSegments } = useFetchTableSegments({ tableId, databaseId });

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ITableColumns>[] = [
Expand All @@ -31,10 +31,7 @@ export const columns: ColumnDef<ITableColumns>[] = [
}
];

export function TableColumns({
tableId,
databaseId
}: DatabaseRouteParams['params']) {
export function TableColumns({ tableId, databaseId }: PureDatabaseRouteParams) {
const { tableColumns } = useFetchTableColumns({ tableId, databaseId });

return (
Expand Down
8 changes: 4 additions & 4 deletions gui/app/(dashboard)/database/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -186,7 +186,7 @@ export const useBuildTreeData = () => {
export const useFetchTableColumns = ({
databaseId,
tableId
}: DatabaseRouteParams['params']) => {
}: PureDatabaseRouteParams) => {
const [tableColumns, setTableColumns] = useState<ITableColumns[]>([]);

const fetchTableColumns = useCallback(async () => {
Expand All @@ -208,7 +208,7 @@ export const useFetchTableColumns = ({
export const useFetchTableIndexes = ({
databaseId,
tableId
}: DatabaseRouteParams['params']) => {
}: PureDatabaseRouteParams) => {
const [tableIndexes, setTableIndexes] = useState<ITableIndex[]>([]);

const fetchTableIndexes = useCallback(async () => {
Expand All @@ -230,7 +230,7 @@ export const useFetchTableIndexes = ({
export const useFetchTableSegments = ({
databaseId,
tableId
}: DatabaseRouteParams['params']) => {
}: PureDatabaseRouteParams) => {
const [tableSegments, setTableSegments] = useState<ITableSegment[]>([]);

const fetchTableSegments = useCallback(async () => {
Expand Down
9 changes: 7 additions & 2 deletions gui/app/(dashboard)/database/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PureDatabaseRouteParams>;
searchParams: Promise<{ tab: Leaf }>;
}
4 changes: 1 addition & 3 deletions gui/app/(dashboard)/databases/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
6 changes: 1 addition & 5 deletions gui/app/(dashboard)/system/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div>
Expand Down
6 changes: 2 additions & 4 deletions gui/app/(dashboard)/tables/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function InfinityTable() {
</TableRow>
</TableHeader>
<TableBody>
{tables.tables.map((table: string) => (
{tables.tables?.map((table: string) => (
<TableRow key={table}>
<TableCell className="font-medium">{table}</TableCell>
</TableRow>
Expand All @@ -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',
Expand Down
1 change: 0 additions & 1 deletion gui/lib/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const request = async (
headers: {
accept: 'application/json'
},
cache: 'no-store',
method
};

Expand Down

0 comments on commit 7655e17

Please sign in to comment.