Skip to content

Commit

Permalink
fix(tags): init tags tree error (#7462)
Browse files Browse the repository at this point in the history
  • Loading branch information
renjie-run authored Feb 14, 2025
1 parent 508e77d commit e8bfdd6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/src/tag/tags-tree-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const TagsTreeView = ({ currentPath }) => {
const [keyTreeNodeExpandedMap, setKeyTreeNodeExpandedMap] = useState({});

const recordsTree = useMemo(() => {
return tagsData.rows_tree || [];
return (tagsData && tagsData.rows_tree) || [];
}, [tagsData]);

const buildTree = useCallback((roots, tree) => {
Expand All @@ -40,6 +40,7 @@ const TagsTreeView = ({ currentPath }) => {
}, [recordsTree, buildTree]);

const getKeyTreeNodeExpandedMap = useCallback(() => {
if (!window.sfTagsDataContext || !window.sfTagsDataContext.localStorage) return {};
const strKeyTreeNodeExpandedMap = window.sfTagsDataContext.localStorage.getItem(LOCAL_KEY_TREE_NODE_EXPANDED);
if (strKeyTreeNodeExpandedMap) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const TagsTableSearcher = () => {
const [searchResult, setSearchResult] = useState(null);

const recordsTree = useMemo(() => {
return tagsData.rows_tree || [];
return (tagsData && tagsData.rows_tree) || [];
}, [tagsData]);

const recordsCount = useMemo(() => {
Expand Down

0 comments on commit e8bfdd6

Please sign in to comment.