Skip to content

Commit

Permalink
fix: trackIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Apr 7, 2024
1 parent c354e25 commit ee3c29c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/SearchCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,17 @@ const searchString = (text: string) => {
return results.length;
};
const refreshExpandedKeys = () => {
const newNode = selectorResults[0].nodes[0];
if (Array.isArray(newNode)) {
props.onUpdateFocusNode(newNode[0]);
} else {
const newResult = selectorResults[0];
const newNode = newResult.nodes[0];
if (!Array.isArray(newNode)) {
props.onUpdateFocusNode(newNode);
} else if (typeof newResult.selector == 'object' && Array.isArray(newNode)) {
props.onUpdateFocusNode(newNode[newResult.selector.trackIndex]);
}
const allKeys = new Set(selectorResults.map((s) => s.key));
const newKeys = expandedKeys.value.filter((k) => allKeys.has(k));
newKeys.push(selectorResults[0].key);
newKeys.push(newResult.key);
expandedKeys.value = newKeys;
};
const searchBySelector = errorTry(() => {
Expand Down

0 comments on commit ee3c29c

Please sign in to comment.