Skip to content

Commit b277c2e

Browse files
committed
fix: regression error
1 parent 00efee1 commit b277c2e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/taxonomy/tag-list/TagListTable.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {
22
useState,
33
useMemo,
4+
useEffect,
45
} from 'react';
56
import type { PaginationState } from '@tanstack/react-table';
67
import { useTagListData, useCreateTag, useUpdateTag } from '@src/taxonomy/data/apiHooks';
@@ -101,6 +102,18 @@ const TagListTable = ({ taxonomyId, maxDepth }: TagListTableProps) => {
101102
setEditingRowId,
102103
});
103104

105+
// RELOAD DATA IN VIEW MODE
106+
useEffect(() => {
107+
// Get row data in VIEW mode. Otherwise keep current data to avoid disrupting
108+
// users while they edit or create a tag.
109+
if (tableMode === TABLE_MODES.VIEW && tagList?.results) {
110+
const tree = new TagTree(tagList?.results);
111+
if (tree) {
112+
setTagTree(tree);
113+
}
114+
}
115+
}, [tagList?.results, tableMode]);
116+
104117
// TreeTable context
105118
const contextValueArgs = {
106119
treeData,

0 commit comments

Comments
 (0)