Skip to content

Commit f6fc189

Browse files
retyuimeta-codesync[bot]
authored andcommitted
Mark unstable_batchedUpdates as deprecated (#58876)
Summary: Since 0.86 (1a623a8), 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. ## Changelog: [GENERAL] [BREAKING] - Mark `unstable_batchedUpdates` as deprecated Pull Request resolved: #58876 Test Plan: ... Reviewed By: christophpurrer Differential Revision: D123669427 Pulled By: javache fbshipit-source-id: dc8f02cc5b7cc63f1ab094b4db7fd9f32f99251c
1 parent 822cfc4 commit f6fc189

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎packages/react-native/index.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,9 @@ module.exports = {
368368
get UIManager() {
369369
return require('./Libraries/ReactNative/UIManager').default;
370370
},
371+
/**
372+
* @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.
373+
*/
371374
unstable_batchedUpdates<T>(fn: (bookkeeping: T) => void, bookkeeping: T) {
372375
fn(bookkeeping);
373376
},

‎packages/react-native/index.js.flow‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,9 @@ export * as Systrace from './Libraries/Performance/Systrace';
442442
export {default as ToastAndroid} from './Libraries/Components/ToastAndroid/ToastAndroid';
443443
export * as TurboModuleRegistry from './Libraries/TurboModule/TurboModuleRegistry';
444444
export {default as UIManager} from './Libraries/ReactNative/UIManager';
445+
/**
446+
* @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.
447+
*/
445448
export function unstable_batchedUpdates<T>(
446449
fn: (bookkeeping: T) => void,
447450
bookkeeping: T,

‎packages/react-native/types_DEPRECATED/public/ReactNativeRenderer.d.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ export interface GestureResponderHandlers {
133133
}
134134

135135
/**
136-
* React Native also implements unstable_batchedUpdates
136+
* @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.
137137
*/
138138
export function unstable_batchedUpdates<A, R>(callback: (a: A) => R, a: A): R;
139+
/**
140+
* @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.
141+
*/
139142
export function unstable_batchedUpdates<R>(callback: () => R): R;

0 commit comments

Comments
 (0)