From 2a8b7f62334458b566fa2a1616df4c0ded9b5cbc Mon Sep 17 00:00:00 2001 From: Sara Vieira Date: Tue, 10 Sep 2024 17:07:09 +0100 Subject: [PATCH] chore: use memo --- .../src/components/charts/RagQueries.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/frontends/analytics/src/components/charts/RagQueries.tsx b/frontends/analytics/src/components/charts/RagQueries.tsx index 2457576b30..4d46b77d25 100644 --- a/frontends/analytics/src/components/charts/RagQueries.tsx +++ b/frontends/analytics/src/components/charts/RagQueries.tsx @@ -11,7 +11,14 @@ import { createSolidTable, } from "@tanstack/solid-table"; import { createQuery, useQueryClient } from "@tanstack/solid-query"; -import { createEffect, createSignal, Show, useContext } from "solid-js"; +import { + Accessor, + createEffect, + createMemo, + createSignal, + Show, + useContext, +} from "solid-js"; import { getRAGQueries } from "../../api/analytics"; import { DatasetContext } from "../../layouts/TopBarLayout"; import { usePagination } from "../../hooks/usePagination"; @@ -83,7 +90,7 @@ export const RagQueries = (props: RagQueriesProps) => { }, })); - const defaultColumns: ColumnDef[] = [ + const columns: Accessor[]> = createMemo(() => [ { accessorKey: "user_message", header: "User Message", @@ -125,7 +132,7 @@ export const RagQueries = (props: RagQueriesProps) => { ); }, }, - ]; + ]); return ( { pageSize: 10, }, }, - columns: defaultColumns, + columns: columns(), getCoreRowModel: getCoreRowModel(), manualPagination: true, });