Skip to content

Commit d7256e5

Browse files
committed
Fix directives table rerender
1 parent a9a95b4 commit d7256e5

File tree

1 file changed

+9
-7
lines changed
  • src/components/Agentic/IncidentDirectives

1 file changed

+9
-7
lines changed

src/components/Agentic/IncidentDirectives/index.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,14 @@ export const IncidentDirectives = () => {
171171
// return conditionMatch || directiveMatch;
172172
// });
173173

174-
return data?.directives?.map((item, index) => ({
175-
...item,
176-
number: index + 1,
177-
isSelected: selectedConditions.includes(item.id)
178-
}));
179-
}, [selectedConditions, data?.directives]);
174+
return (
175+
data?.directives?.map((item, index) => ({
176+
...item,
177+
number: index + 1,
178+
isSelected: selectedConditions.includes(item.id)
179+
})) ?? []
180+
);
181+
}, [selectedConditions, data]);
180182

181183
const columns = [
182184
columnHelper.accessor((x) => x, {
@@ -295,7 +297,7 @@ export const IncidentDirectives = () => {
295297
];
296298

297299
const table = useReactTable({
298-
data: items ?? [],
300+
data: items,
299301
columns,
300302
getCoreRowModel: getCoreRowModel(),
301303
getSortedRowModel: getSortedRowModel(),

0 commit comments

Comments
 (0)