Skip to content

Commit

Permalink
Merge branch 'main' into release/1.53
Browse files Browse the repository at this point in the history
* main:
  fix(ui): cache data list for flags and segments (#3690)
  • Loading branch information
markphelps committed Dec 6, 2024
2 parents ac396b5 + bd51023 commit 07013fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ui/src/components/flags/FlagTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Row,
useReactTable
} from '@tanstack/react-table';
import { useState, useEffect } from 'react';
import { useState, useEffect, useMemo } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import { DataTablePagination } from '~/components/ui/table-pagination';
Expand Down Expand Up @@ -138,7 +138,7 @@ export default function FlagTable(props: FlagTableProps) {
const sorting = useSelector(selectSorting);

const { data, isLoading, error } = useListFlagsQuery(namespace.key);
const flags = data?.flags || [];
const flags = useMemo(() => data?.flags || [], [data]);

const { setError } = useError();
useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/segments/SegmentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Row,
useReactTable
} from '@tanstack/react-table';
import { useState, useEffect } from 'react';
import { useState, useEffect, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { selectSorting, setSorting } from '~/app/segments/segmentsApi';
import { useTimezone } from '~/data/hooks/timezone';
Expand Down Expand Up @@ -130,7 +130,7 @@ export default function SegmentTable(props: SegmentTableProps) {

const sorting = useSelector(selectSorting);
const { data, isLoading, error } = useListSegmentsQuery(namespace.key);
const segments = data?.segments || [];
const segments = useMemo(() => data?.segments || [], [data]);
const table = useReactTable({
data: segments,
columns,
Expand Down

0 comments on commit 07013fb

Please sign in to comment.