Skip to content

Commit

Permalink
chore: use memo
Browse files Browse the repository at this point in the history
  • Loading branch information
SaraVieira authored and skeptrunedev committed Sep 13, 2024
1 parent f56b183 commit 2a8b7f6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions frontends/analytics/src/components/charts/RagQueries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -83,7 +90,7 @@ export const RagQueries = (props: RagQueriesProps) => {
},
}));

const defaultColumns: ColumnDef<RagQueryEvent>[] = [
const columns: Accessor<ColumnDef<RagQueryEvent>[]> = createMemo(() => [
{
accessorKey: "user_message",
header: "User Message",
Expand Down Expand Up @@ -125,7 +132,7 @@ export const RagQueries = (props: RagQueriesProps) => {
);
},
},
];
]);

return (
<ChartCard
Expand Down Expand Up @@ -160,7 +167,7 @@ export const RagQueries = (props: RagQueriesProps) => {
pageSize: 10,
},
},
columns: defaultColumns,
columns: columns(),
getCoreRowModel: getCoreRowModel(),
manualPagination: true,
});
Expand Down

0 comments on commit 2a8b7f6

Please sign in to comment.