From 6f10c831834d3087ef4b49974b6bc2c9e830a605 Mon Sep 17 00:00:00 2001 From: D N <4661784+retyui@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:40:33 +0200 Subject: [PATCH] Mark unstable_batchedUpdates as deprecated Since 0.86 (1a623a8266), unstable_batchedUpdates is a no-op that synchronously invokes the passed callback. Add @deprecated JSDoc to the runtime export and the Flow and TypeScript definitions. --- packages/react-native/index.js | 3 +++ packages/react-native/index.js.flow | 3 +++ .../types_DEPRECATED/public/ReactNativeRenderer.d.ts | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 08c71232d66a..79b601abb36d 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -368,6 +368,9 @@ module.exports = { get UIManager() { return require('./Libraries/ReactNative/UIManager').default; }, + /** + * @deprecated Since 0.86, `unstable_batchedUpdates` is a no-op that synchronously invokes the callback. React batches updates automatically, so call the callback directly instead. + */ unstable_batchedUpdates(fn: (bookkeeping: T) => void, bookkeeping: T) { fn(bookkeeping); }, diff --git a/packages/react-native/index.js.flow b/packages/react-native/index.js.flow index 1886486c571c..6214d033bc16 100644 --- a/packages/react-native/index.js.flow +++ b/packages/react-native/index.js.flow @@ -442,6 +442,9 @@ export * as Systrace from './Libraries/Performance/Systrace'; export {default as ToastAndroid} from './Libraries/Components/ToastAndroid/ToastAndroid'; export * as TurboModuleRegistry from './Libraries/TurboModule/TurboModuleRegistry'; export {default as UIManager} from './Libraries/ReactNative/UIManager'; +/** + * @deprecated Since 0.86, `unstable_batchedUpdates` is a no-op that synchronously invokes the callback. React batches updates automatically, so call the callback directly instead. + */ export function unstable_batchedUpdates( fn: (bookkeeping: T) => void, bookkeeping: T, diff --git a/packages/react-native/types_DEPRECATED/public/ReactNativeRenderer.d.ts b/packages/react-native/types_DEPRECATED/public/ReactNativeRenderer.d.ts index 830898537f09..3e2bb07242ae 100644 --- a/packages/react-native/types_DEPRECATED/public/ReactNativeRenderer.d.ts +++ b/packages/react-native/types_DEPRECATED/public/ReactNativeRenderer.d.ts @@ -133,7 +133,10 @@ export interface GestureResponderHandlers { } /** - * React Native also implements unstable_batchedUpdates + * @deprecated Since 0.86, `unstable_batchedUpdates` is a no-op that synchronously invokes the callback. React batches updates automatically, so call the callback directly instead. */ export function unstable_batchedUpdates(callback: (a: A) => R, a: A): R; +/** + * @deprecated Since 0.86, `unstable_batchedUpdates` is a no-op that synchronously invokes the callback. React batches updates automatically, so call the callback directly instead. + */ export function unstable_batchedUpdates(callback: () => R): R;