Skip to content

Commit

Permalink
update internal state if data prop changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Feb 2, 2023
1 parent bf8c6d0 commit 8a3222d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/analyst/src/components/AnalystTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export default function AnalystTable({
loadData();
}, [url]);

useEffect(() => {
setData(initialData);
}, [initialData]);

useEffect(() => {
if (!data || data.length === 0) {
return;
Expand Down Expand Up @@ -324,7 +328,7 @@ export default function AnalystTable({
</TableHead>
<TableBody>
{slicedData.map((row, i) => (
<TableRow key={i}>
<TableRow key={id_column ? row[id_column] : i}>
{columns.map((column) => (
<Cell
key={column.name}
Expand Down

0 comments on commit 8a3222d

Please sign in to comment.