Skip to content

Commit 95e8d62

Browse files
committed
Speed up indeterminateKeys computation; add JSDoc @default
1 parent 5edd90a commit 95e8d62

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/@react-stately/selection/src/TreeSelectionManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ export class TreeSelectionManager extends SelectionManager {
5959
this.selection.forEach(key => {
6060
for (let parent of getAncestors(this.collection, key)) {
6161
if (this.isSelected(parent.key)) {
62-
continue;
62+
break;
6363
}
6464

65-
if (this.isPartiallyChecked(parent.key)) {
65+
if (this.isPartiallySelected(parent.key)) {
6666
keys.add(parent.key);
6767
}
6868
}
@@ -164,7 +164,7 @@ export class TreeSelectionManager extends SelectionManager {
164164
return keys;
165165
}
166166

167-
private isPartiallyChecked(key: Key) {
167+
private isPartiallySelected(key: Key) {
168168
let queue: Node<unknown>[] = [];
169169
queue.push(...getChildren(this.collection, key));
170170

packages/react-aria-components/src/Tree.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ export interface TreeProps<T> extends Omit<AriaTreeProps<T>, 'children'>, Multip
152152
dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>,
153153
/** Whether selection propagates between parent and child nodes. */
154154
selectionPropagation?: boolean,
155-
/** Specifies which keys are included in the selection. */
155+
/**
156+
* Specifies which keys are included in the selection.
157+
* @default 'all'
158+
*/
156159
selectionStrategy?: SelectionStrategy
157160
}
158161

0 commit comments

Comments
 (0)