Skip to content

Commit 06c160b

Browse files
authored
Merge pull request #91799 from callstack-internal/VickyStash/bugfix/91584-flashlist-web-subpixel-loop
2 parents 1bd7bd1 + f8bd162 commit 06c160b

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/node_modules/@shopify/flash-list/dist/recyclerview/utils/measureLayout.web.js b/node_modules/@shopify/flash-list/dist/recyclerview/utils/measureLayout.web.js
2+
index 17d9812..fe112f1 100644
3+
--- a/node_modules/@shopify/flash-list/dist/recyclerview/utils/measureLayout.web.js
4+
+++ b/node_modules/@shopify/flash-list/dist/recyclerview/utils/measureLayout.web.js
5+
@@ -28,7 +28,10 @@ export function areDimensionsEqual(value1, value2) {
6+
return Math.abs(value1 - value2) <= 1;
7+
}
8+
export function roundOffPixel(value) {
9+
- return value;
10+
+ const dpr = typeof window !== "undefined" && window.devicePixelRatio
11+
+ ? window.devicePixelRatio
12+
+ : 1;
13+
+ return Math.round(value * dpr) / dpr;
14+
}
15+
/**
16+
* Measures the size of the RecyclerView's outer container.

patches/@shopify/flash-list/details.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,12 @@
7474
- Upstream PR/issue: https://github.com/Shopify/flash-list/issues/2291
7575
- E/App issue: https://github.com/Expensify/App/issues/89933
7676
- PR introducing patch: https://github.com/Expensify/App/pull/91248
77+
78+
### [@shopify+flash-list+2.3.0+010+fix-web-subpixel-rounding.patch](@shopify+flash-list+2.3.0+010+fix-web-subpixel-rounding.patch)
79+
80+
- Reason: Fixes a "Maximum update depth exceeded" infinite render loop on web (mostly Windows with fractional display scaling). `roundOffPixel` on web was a no-op, so subpixel drift in the child container's `getBoundingClientRect()` width re-triggered `ViewHolderCollection`'s `[fixedContainerSize]` layout effect on every measurement. The patch implements `roundOffPixel` to snap to the device-pixel grid (`Math.round(value * devicePixelRatio) / devicePixelRatio`), matching native `PixelRatio.roundToNearestPixel`. Two measurements that paint the same physical pixel now collapse to the same JS value, breaking the loop.
81+
- Files changed: `dist/recyclerview/utils/measureLayout.web.js` only.
82+
- Upstream PR/issue: TBD
83+
- E/App issue: https://github.com/Expensify/App/issues/91584
84+
- Sentry: https://expensify.sentry.io/issues/APP-DQ2
85+
- PR introducing patch: https://github.com/Expensify/App/pull/91799

0 commit comments

Comments
 (0)