@primer/react 0.0.0-20260219122135 → 0.0.0-20260219144324

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,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260219122135
3
+ ## 0.0.0-20260219144324
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -26,6 +26,8 @@
26
26
 
27
27
  - [#7548](https://github.com/primer/react/pull/7548) [`d4b32c3`](https://github.com/primer/react/commit/d4b32c3672d3d5421711324654c1028527dcdf38) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useIsMacOS): replace useState+useEffect with useSyncExternalStore to eliminate unnecessary re-render
28
28
 
29
+ - [#7547](https://github.com/primer/react/pull/7547) [`36ee7ce`](https://github.com/primer/react/commit/36ee7ce5d5fd074e137d11338d6b852721130d29) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useScrollFlash): defer scroll read/write to requestAnimationFrame to avoid forced reflow
30
+
29
31
  ## 38.12.0
30
32
 
31
33
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollFlash.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollFlash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,QAe7F"}
1
+ {"version":3,"file":"useScrollFlash.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollFlash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,QAoB7F"}
@@ -15,11 +15,13 @@ function useScrollFlash(scrollContainerRef) {
15
15
  if (!scrollContainer) {
16
16
  return;
17
17
  }
18
- const currentScroll = scrollContainer.scrollTop;
19
- const maxScroll = scrollContainer.scrollHeight;
20
- const altScroll = currentScroll < Math.min(1, maxScroll) ? currentScroll + 1 : currentScroll - 1;
21
- scrollContainer.scrollTop = altScroll;
22
- scrollContainer.scrollTop = currentScroll;
18
+ const id = requestAnimationFrame(() => {
19
+ const currentScroll = scrollContainer.scrollTop;
20
+ const altScroll = currentScroll < 1 ? currentScroll + 1 : currentScroll - 1;
21
+ scrollContainer.scrollTop = altScroll;
22
+ scrollContainer.scrollTop = currentScroll;
23
+ });
24
+ return () => cancelAnimationFrame(id);
23
25
  };
24
26
  t1 = [scrollContainerRef];
25
27
  $[0] = scrollContainerRef;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260219122135",
4
+ "version": "0.0.0-20260219144324",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",