@primer/react 0.0.0-20260219184342 → 0.0.0-20260219184403
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260219184403
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Fake entry to force publishing
|
|
8
8
|
|
|
9
|
-
- [#
|
|
9
|
+
- [#7498](https://github.com/primer/react/pull/7498) [`0c19492`](https://github.com/primer/react/commit/0c19492ec6fea2b35746307dd0cf8f3ab0746d99) Thanks [@hectahertz](https://github.com/hectahertz)! - Remove render phase setStates on SelectPanel
|
|
10
|
+
|
|
11
|
+
- [#7497](https://github.com/primer/react/pull/7497) [`0b696cc`](https://github.com/primer/react/commit/0b696cc75435b01aacc15e81396fe26e5901c01b) Thanks [@hectahertz](https://github.com/hectahertz)! - Improve SelectPanel performance
|
|
10
12
|
|
|
11
13
|
## 38.13.0
|
|
12
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectPanel.d.ts","sourceRoot":"","sources":["../../src/SelectPanel/SelectPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAC1F,OAAO,KAAK,EAAE,EAA+E,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACnH,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,iCAAiC,EAAC,MAAM,oCAAoC,CAAA;AACzF,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAA;AAGlE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAY,SAAS,EAAC,MAAM,IAAI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+B,EAC/B,yBAAyB,EACzB,KAAK,EACL,aAAqB,EACrB,sBAAsB,EACtB,GAAG,SAAS,EACb,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAgyBhC;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAM1C,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,GAAG,WAAW,CAM1D,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;CAItB,CAAA"}
|
|
@@ -132,8 +132,6 @@ function Panel({
|
|
|
132
132
|
wide: false
|
|
133
133
|
}, false);
|
|
134
134
|
const [selectedOnSort, setSelectedOnSort] = useState([]);
|
|
135
|
-
const [prevItems, setPrevItems] = useState([]);
|
|
136
|
-
const [prevOpen, setPrevOpen] = useState(open);
|
|
137
135
|
const initialHeightRef = useRef(0);
|
|
138
136
|
const initialScaleRef = useRef(1);
|
|
139
137
|
const noticeRef = useRef(null);
|
|
@@ -205,6 +203,19 @@ function Panel({
|
|
|
205
203
|
resetSort();
|
|
206
204
|
}
|
|
207
205
|
}, [loadingManagedInternally, externalOnFilterChange, setInternalFilterValue, dataLoadedOnce, safeSetTimeout, safeClearTimeout, items.length, resetSort]);
|
|
206
|
+
|
|
207
|
+
// Pre-compute a Set of item IDs in the current filtered view for O(1) lookups
|
|
208
|
+
const itemsInViewSet = useMemo(() => {
|
|
209
|
+
const set = new Set();
|
|
210
|
+
for (const item of items) {
|
|
211
|
+
if (item.id !== undefined) {
|
|
212
|
+
set.add(item.id);
|
|
213
|
+
} else {
|
|
214
|
+
set.add(item);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return set;
|
|
218
|
+
}, [items]);
|
|
208
219
|
const handleSelectAllChange = useCallback(checked => {
|
|
209
220
|
// Exit early if not in multi-select mode
|
|
210
221
|
if (!isMultiSelectVariant(selected)) {
|
|
@@ -212,13 +223,20 @@ function Panel({
|
|
|
212
223
|
}
|
|
213
224
|
const multiSelectOnChange = onSelectedChange;
|
|
214
225
|
const selectedArray = selected;
|
|
215
|
-
|
|
226
|
+
|
|
227
|
+
// Use Set for O(1) lookup instead of O(n) items.some()
|
|
228
|
+
const selectedItemsNotInFilteredView = selectedArray.filter(selectedItem => {
|
|
229
|
+
if (selectedItem.id !== undefined) {
|
|
230
|
+
return !itemsInViewSet.has(selectedItem.id);
|
|
231
|
+
}
|
|
232
|
+
return !itemsInViewSet.has(selectedItem);
|
|
233
|
+
});
|
|
216
234
|
if (checked) {
|
|
217
235
|
multiSelectOnChange([...selectedItemsNotInFilteredView, ...items]);
|
|
218
236
|
} else {
|
|
219
237
|
multiSelectOnChange(selectedItemsNotInFilteredView);
|
|
220
238
|
}
|
|
221
|
-
}, [items, onSelectedChange, selected]);
|
|
239
|
+
}, [items, itemsInViewSet, onSelectedChange, selected]);
|
|
222
240
|
|
|
223
241
|
// disable body scroll when the panel is open on narrow screens
|
|
224
242
|
useEffect(() => {
|
|
@@ -384,10 +402,29 @@ function Panel({
|
|
|
384
402
|
});
|
|
385
403
|
};
|
|
386
404
|
}, [placeholder, renderAnchor, selected]);
|
|
405
|
+
|
|
406
|
+
// Pre-compute a Set of selected item IDs/references for O(1) lookups
|
|
407
|
+
// This optimizes isItemCurrentlySelected from O(m) to O(1) per call
|
|
408
|
+
const selectedItemsSet = useMemo(() => {
|
|
409
|
+
const set = new Set();
|
|
410
|
+
if (isMultiSelectVariant(selected)) {
|
|
411
|
+
for (const item of selected) {
|
|
412
|
+
if (item.id !== undefined) {
|
|
413
|
+
set.add(item.id);
|
|
414
|
+
} else {
|
|
415
|
+
set.add(item);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return set;
|
|
420
|
+
}, [selected]);
|
|
387
421
|
const isItemCurrentlySelected = useCallback(item => {
|
|
388
|
-
// For multi-select,
|
|
422
|
+
// For multi-select, use the pre-computed Set for O(1) lookup
|
|
389
423
|
if (isMultiSelectVariant(selected)) {
|
|
390
|
-
|
|
424
|
+
if (item.id !== undefined) {
|
|
425
|
+
return selectedItemsSet.has(item.id);
|
|
426
|
+
}
|
|
427
|
+
return selectedItemsSet.has(item);
|
|
391
428
|
}
|
|
392
429
|
|
|
393
430
|
// For single-select modal, there is an intermediate state when the user has selected
|
|
@@ -398,8 +435,24 @@ function Panel({
|
|
|
398
435
|
|
|
399
436
|
// For single-select anchored, we just need to check if the item is the selected item
|
|
400
437
|
return (selected === null || selected === void 0 ? void 0 : selected.id) !== undefined ? selected.id === item.id : selected === item;
|
|
401
|
-
}, [selected, intermediateSelected, isSingleSelectModal]);
|
|
438
|
+
}, [selected, selectedItemsSet, intermediateSelected, isSingleSelectModal]);
|
|
402
439
|
const itemsToRender = useMemo(() => {
|
|
440
|
+
// Pre-compute a Set of selected item IDs/references for O(1) lookups during sorting
|
|
441
|
+
// This avoids O(m * k) work per comparison in the sort function
|
|
442
|
+
const selectedOnSortSet = new Set();
|
|
443
|
+
for (const item of selectedOnSort) {
|
|
444
|
+
if (item.id !== undefined) {
|
|
445
|
+
selectedOnSortSet.add(item.id);
|
|
446
|
+
} else {
|
|
447
|
+
selectedOnSortSet.add(item);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
const isSelectedForSort = item => {
|
|
451
|
+
if (item.id !== undefined) {
|
|
452
|
+
return selectedOnSortSet.has(item.id);
|
|
453
|
+
}
|
|
454
|
+
return selectedOnSortSet.has(item);
|
|
455
|
+
};
|
|
403
456
|
return items.map(item => {
|
|
404
457
|
return {
|
|
405
458
|
...item,
|
|
@@ -436,42 +489,39 @@ function Panel({
|
|
|
436
489
|
};
|
|
437
490
|
}).sort((itemA, itemB) => {
|
|
438
491
|
if (shouldOrderSelectedFirst) {
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
if (key === 'selected') {
|
|
442
|
-
return true;
|
|
443
|
-
}
|
|
444
|
-
return itemA[key] === value;
|
|
445
|
-
}));
|
|
446
|
-
|
|
447
|
-
// itemB is selected (for sorting purposes) if an object in selectedOnSort matches every property of itemA, except for the selected property
|
|
448
|
-
const itemBSelected = selectedOnSort.some(item => Object.entries(item).every(([key, value]) => {
|
|
449
|
-
if (key === 'selected') {
|
|
450
|
-
return true;
|
|
451
|
-
}
|
|
452
|
-
return itemB[key] === value;
|
|
453
|
-
}));
|
|
492
|
+
const itemASelected = isSelectedForSort(itemA);
|
|
493
|
+
const itemBSelected = isSelectedForSort(itemB);
|
|
454
494
|
|
|
455
495
|
// order selected items first
|
|
456
|
-
if (itemASelected
|
|
496
|
+
if (itemASelected && !itemBSelected) {
|
|
457
497
|
return -1;
|
|
458
|
-
} else if (itemASelected
|
|
498
|
+
} else if (!itemASelected && itemBSelected) {
|
|
459
499
|
return 1;
|
|
460
500
|
}
|
|
461
501
|
}
|
|
462
502
|
return 0;
|
|
463
503
|
});
|
|
464
504
|
}, [onClose, onSelectedChange, items, selected, isItemCurrentlySelected, isSingleSelectModal, intermediateSelected, shouldOrderSelectedFirst, selectedOnSort]);
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
505
|
+
|
|
506
|
+
// Track previous items and reset sort when items first load
|
|
507
|
+
const prevItemsRef = useRef(items);
|
|
508
|
+
useEffect(() => {
|
|
509
|
+
if (prevItemsRef.current !== items) {
|
|
510
|
+
if (prevItemsRef.current.length === 0 && items.length > 0) {
|
|
511
|
+
resetSort();
|
|
512
|
+
}
|
|
513
|
+
prevItemsRef.current = items;
|
|
514
|
+
}
|
|
515
|
+
}, [items, resetSort]);
|
|
516
|
+
|
|
517
|
+
// Reset sort when panel opens
|
|
518
|
+
const prevOpenRef = useRef(open);
|
|
519
|
+
useEffect(() => {
|
|
520
|
+
if (prevOpenRef.current !== open) {
|
|
468
521
|
resetSort();
|
|
522
|
+
prevOpenRef.current = open;
|
|
469
523
|
}
|
|
470
|
-
}
|
|
471
|
-
if (open !== prevOpen) {
|
|
472
|
-
setPrevOpen(open);
|
|
473
|
-
resetSort();
|
|
474
|
-
}
|
|
524
|
+
}, [open, resetSort]);
|
|
475
525
|
const focusTrapSettings = {
|
|
476
526
|
initialFocusRef: inputRef || undefined
|
|
477
527
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRefObjectAsForwardedRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefObjectAsForwardedRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AAGlD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"useRefObjectAsForwardedRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefObjectAsForwardedRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AAGlD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAEjH"}
|
|
@@ -9,7 +9,7 @@ import { useImperativeHandle } from 'react';
|
|
|
9
9
|
* **NOTE**: The `refObject` should be passed to the underlying element, NOT the `forwardedRef`.
|
|
10
10
|
*/
|
|
11
11
|
function useRefObjectAsForwardedRef(forwardedRef, refObject) {
|
|
12
|
-
const $ = c(
|
|
12
|
+
const $ = c(2);
|
|
13
13
|
let t0;
|
|
14
14
|
if ($[0] !== refObject.current) {
|
|
15
15
|
t0 = () => refObject.current;
|
|
@@ -18,15 +18,7 @@ function useRefObjectAsForwardedRef(forwardedRef, refObject) {
|
|
|
18
18
|
} else {
|
|
19
19
|
t0 = $[1];
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
if ($[2] !== refObject) {
|
|
23
|
-
t1 = [refObject];
|
|
24
|
-
$[2] = refObject;
|
|
25
|
-
$[3] = t1;
|
|
26
|
-
} else {
|
|
27
|
-
t1 = $[3];
|
|
28
|
-
}
|
|
29
|
-
useImperativeHandle(forwardedRef, t0, t1);
|
|
21
|
+
useImperativeHandle(forwardedRef, t0);
|
|
30
22
|
}
|
|
31
23
|
|
|
32
24
|
export { useRefObjectAsForwardedRef };
|
package/package.json
CHANGED