fix: overall perf improvements
* fix: ignore private ips * fix: performance related fixes * fix: simply event buffer * fix: default to 1 events queue shard * add: cleanup scripts * fix: comments * fix comments * fix * fix: groupmq * wip * fix: sync cachable * remove cluster names and add it behind env flag (if someone want to scale) * fix * wip * better logger * remove reqid and user agent * fix lock * remove wait_for_async_insert
This commit is contained in:
committed by
GitHub
parent
38cc53890a
commit
da59622dce
@@ -4,8 +4,8 @@ import type {
|
||||
VisibilityState,
|
||||
} from '@tanstack/react-table';
|
||||
import { parseAsInteger, useQueryState } from 'nuqs';
|
||||
import { useState } from 'react';
|
||||
import { useLocalStorage } from 'usehooks-ts';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useLocalStorage, useReadLocalStorage } from 'usehooks-ts';
|
||||
|
||||
export const useDataTablePagination = (pageSize = 10) => {
|
||||
const [page, setPage] = useQueryState(
|
||||
@@ -22,6 +22,12 @@ export const useDataTablePagination = (pageSize = 10) => {
|
||||
return { page, setPage, state };
|
||||
};
|
||||
|
||||
export const useReadColumnVisibility = (persistentKey: string) => {
|
||||
return useReadLocalStorage<Record<string, boolean>>(
|
||||
`@op:${persistentKey}-column-visibility`,
|
||||
);
|
||||
};
|
||||
|
||||
export const useDataTableColumnVisibility = <TData,>(
|
||||
columns: ColumnDef<TData>[],
|
||||
persistentKey: string,
|
||||
@@ -43,6 +49,13 @@ export const useDataTableColumnVisibility = <TData,>(
|
||||
}, {} as VisibilityState),
|
||||
);
|
||||
|
||||
// somewhat hack
|
||||
// Set initial column visibility,
|
||||
// otherwise will not useReadColumnVisibility be updated
|
||||
useEffect(() => {
|
||||
setColumnVisibility(columnVisibility);
|
||||
}, []);
|
||||
|
||||
const [columnOrder, setColumnOrder] = useLocalStorage<string[]>(
|
||||
`@op:${persistentKey}-column-order`,
|
||||
columns.map((column) => column.id!),
|
||||
|
||||
Reference in New Issue
Block a user