feat: add `deferFlushSync` option for React 19 compatibility #1098
Closedchannyeintun(GitHub profile, opens in a new tab)wants to merge 6 commits into
main fromrefs/pull/1098/headopened channyeintun(GitHub profile, opens in a new tab) changed the title
piecyk requested changes
@@ -348,3 +348,13 @@348348 enabled?: boolean349349 isRtl?: boolean350350 useAnimationFrameWithResizeObserver?: boolean351+ /**352+ * If true, defers the flushSync call during synchronous updates to a microtask.353+ * This suppresses the React 19 warning: "flushSync was called from inside a lifecycle method."354+ *355+ * @warning Enabling this may cause visible white space gaps during fast scrolling356+ * with dynamic measurements, as the scroll correction won't be applied synchronously.357+ *358+ * @default false359+ */360+ deferFlushSync?: boolean@@ -28,4 +28,5 @@2828 ...options,2929 onChange: (instance, sync) => {3030 if (sync) {31- flushSync(rerender)31+ if (options.deferFlushSync) {32+ queueMicrotask(() => flushSync(rerender))@@ -28,4 +28,4 @@2828 ...options,2929 onChange: (instance, sync) => {3030 if (sync) {31- flushSync(rerender)31+ if (options.deferFlushSync) {channyeintun(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: fa4acc3649420f84bdc9c9b54c6a9a6c2a30c11c
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR