Skip to content

Commit

Permalink
add guard to avoid runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gene9831 committed Jan 24, 2025
1 parent ba62f9f commit 5f7b024
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/plugins/page/src/composable/usePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ const changeTreeData = (newParentId, oldParentId) => {
if (newParentId && oldParentId && String(newParentId) !== String(oldParentId)) {
const folderData = getParentNode(newParentId)
const parentData = getParentNode(oldParentId)

if (!folderData || !parentData) {
return
}

const currentPageDataId = pageSettingState.currentPageData.id
const curDataIndex = parentData.children?.findIndex?.(({ id }) => id === currentPageDataId)

Expand Down

0 comments on commit 5f7b024

Please sign in to comment.