🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(data-tables): pagination not adjusted by enter key (#7425)
Nimar8d19030391e0
diff --git a/web/src/components/table/data-table-pagination.tsx b/web/src/components/table/data-table-pagination.tsxindex f3dff76bc4..1fcbb02878 100644--- a/web/src/components/table/data-table-pagination.tsx+++ b/web/src/components/table/data-table-pagination.tsx@@ -47,6 +47,29 @@ export function DataTablePagination<TData>({}}, [currentPage, pageCount, setPageIndex]);+ const handlePageNavigation = (newValue: string) => {+ if (newValue === "") {+ table.setPageIndex(0);+ setInputState(1);+ return;+ }++ // if nan, reset to current page+ if (isNaN(Number(newValue))) {+ setInputState(currentPage);+ return;+ }++ const newPageIndex = Number(newValue) - 1;+ if (newPageIndex < 0 || newPageIndex >= pageCount) {+ setInputState(currentPage);+ return;+ }++ table.setPageIndex(newPageIndex);+ setInputState(newPageIndex + 1);+ };+return (<div className="flex items-center justify-between"><div className="flex-1 text-sm text-muted-foreground">@@ -94,28 +117,14 @@ export function DataTablePagination<TData>({onChange={(e) => {setInputState(e.target.value);}}- onBlur={(e) => {- const newValue = e.target.value;- if (newValue === "") {- table.setPageIndex(0);- setInputState(1);- return;+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ e.preventDefault();+ handlePageNavigation(e.currentTarget.value);}-- // if nan, reset to current page- if (isNaN(Number(newValue))) {- setInputState(currentPage);- return;- }-- const newPageIndex = Number(newValue) - 1;- if (newPageIndex < 0 || newPageIndex >= pageCount) {- setInputState(currentPage);- return;- }-- table.setPageIndex(newPageIndex);- setInputState(newPageIndex + 1);+ }}+ onBlur={(e) => {+ handlePageNavigation(e.target.value);}}className="h-8 appearance-none"style={{