Skip to content

Commit

Permalink
feat(dom): avoid get self depth when skip sortByIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
zealotchen0 committed Apr 12, 2024
1 parent 32c019a commit 45edc2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dom/src/dom/root_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ void RootNode::CreateDomNodes(std::vector<std::shared_ptr<DomInfo>>&& nodes, boo
OnDomNodeCreated(node);
}
for (const auto& node : nodes_to_create) {
node->SetRenderInfo({node->GetId(), node->GetPid(), node->GetSelfIndex(), node->GetSelfDepth()});
if (needSortByIndex) {
node->SetRenderInfo({node->GetId(), node->GetPid(), node->GetSelfIndex(), node->GetSelfDepth()});
} else {
// 如果不需要对 index 排序,其他场景目前没有用到 depth,避免冗余计算
node->SetRenderInfo({node->GetId(), node->GetPid(), node->GetSelfIndex(), -1});
}
}

if (needSortByIndex) {
Expand Down

0 comments on commit 45edc2c

Please sign in to comment.