Skip to content

Commit

Permalink
VirtualizedList: Delete Batchinator (#48515)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #48515

Deletes `Batchinator`, inlines the timer, and cleans up the `disableInteractionManagerInBatchinator` feature flag.

Changelog:
[Internal]

Reviewed By: javache, NickGerleman

Differential Revision: D67885194

fbshipit-source-id: 5f3ec71a02cf1f1b382b41a480beed28fc8c5439
  • Loading branch information
yungsters authored and facebook-github-bot committed Jan 22, 2025
1 parent ff0bcb2 commit c8a387c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9856,7 +9856,6 @@ exports[`public API should not change unintentionally src/private/featureflags/R
animatedShouldDebounceQueueFlush: Getter<boolean>,
animatedShouldUseSingleOp: Getter<boolean>,
disableInteractionManager: Getter<boolean>,
disableInteractionManagerInBatchinator: Getter<boolean>,
enableAccessToHostTreeInFabric: Getter<boolean>,
enableAnimatedAllowlist: Getter<boolean>,
enableAnimatedClearImmediateFix: Getter<boolean>,
Expand Down Expand Up @@ -9927,7 +9926,6 @@ declare export const jsOnlyTestFlag: Getter<boolean>;
declare export const animatedShouldDebounceQueueFlush: Getter<boolean>;
declare export const animatedShouldUseSingleOp: Getter<boolean>;
declare export const disableInteractionManager: Getter<boolean>;
declare export const disableInteractionManagerInBatchinator: Getter<boolean>;
declare export const enableAccessToHostTreeInFabric: Getter<boolean>;
declare export const enableAnimatedAllowlist: Getter<boolean>;
declare export const enableAnimatedClearImmediateFix: Getter<boolean>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,16 +529,6 @@ const definitions: FeatureFlagDefinitions = {
purpose: 'experimentation',
},
},
disableInteractionManagerInBatchinator: {
defaultValue: false,
metadata: {
dateAdded: '2024-11-18',
description:
'Skips InteractionManager in `Batchinator` and invokes callbacks synchronously.',
expectedReleaseValue: true,
purpose: 'experimentation',
},
},
enableAccessToHostTreeInFabric: {
defaultValue: false,
metadata: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<8ab1581a5660c8148c1ff87e12c042cc>>
* @generated SignedSource<<e710f456c7fa57f98e46cbc467755503>>
* @flow strict
*/

Expand All @@ -31,7 +31,6 @@ export type ReactNativeFeatureFlagsJsOnly = $ReadOnly<{
animatedShouldDebounceQueueFlush: Getter<boolean>,
animatedShouldUseSingleOp: Getter<boolean>,
disableInteractionManager: Getter<boolean>,
disableInteractionManagerInBatchinator: Getter<boolean>,
enableAccessToHostTreeInFabric: Getter<boolean>,
enableAnimatedAllowlist: Getter<boolean>,
enableAnimatedClearImmediateFix: Getter<boolean>,
Expand Down Expand Up @@ -120,11 +119,6 @@ export const animatedShouldUseSingleOp: Getter<boolean> = createJavaScriptFlagGe
*/
export const disableInteractionManager: Getter<boolean> = createJavaScriptFlagGetter('disableInteractionManager', false);

/**
* Skips InteractionManager in `Batchinator` and invokes callbacks synchronously.
*/
export const disableInteractionManagerInBatchinator: Getter<boolean> = createJavaScriptFlagGetter('disableInteractionManagerInBatchinator', false);

/**
* Enables access to the host tree in Fabric using DOM-compatible APIs.
*/
Expand Down
85 changes: 0 additions & 85 deletions packages/virtualized-lists/Interaction/Batchinator.js

This file was deleted.

This file was deleted.

21 changes: 12 additions & 9 deletions packages/virtualized-lists/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import type {
ScrollEvent,
} from 'react-native/Libraries/Types/CoreEventTypes';

import Batchinator from '../Interaction/Batchinator';
import clamp from '../Utilities/clamp';
import infoLog from '../Utilities/infoLog';
import {CellRenderMask} from './CellRenderMask';
Expand Down Expand Up @@ -375,10 +374,6 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
this._checkProps(props);

this._fillRateHelper = new FillRateHelper(this._listMetrics);
this._updateCellsToRenderBatcher = new Batchinator(
this._updateCellsToRender,
this.props.updateCellsBatchingPeriod ?? 50,
);

if (this.props.viewabilityConfigCallbackPairs) {
this._viewabilityTuples = this.props.viewabilityConfigCallbackPairs.map(
Expand Down Expand Up @@ -687,7 +682,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
if (this._isNestedWithSameOrientation()) {
this.context.unregisterAsNestedChild({ref: this});
}
this._updateCellsToRenderBatcher.dispose();
clearTimeout(this._updateCellsToRenderTimeoutID);
this._viewabilityTuples.forEach(tuple => {
tuple.viewabilityHelper.dispose();
});
Expand Down Expand Up @@ -1228,7 +1223,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
_scrollRef: ?React.ElementRef<any> = null;
_sentStartForContentLength = 0;
_sentEndForContentLength = 0;
_updateCellsToRenderBatcher: Batchinator;
_updateCellsToRenderTimeoutID: ?TimeoutID = null;
_viewabilityTuples: Array<ViewabilityHelperCallbackTuple> = [];

/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
Expand Down Expand Up @@ -1763,11 +1758,19 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
this._hiPriInProgress = true;
// Don't worry about interactions when scrolling quickly; focus on filling content as fast
// as possible.
this._updateCellsToRenderBatcher.dispose();
if (this._updateCellsToRenderTimeoutID != null) {
clearTimeout(this._updateCellsToRenderTimeoutID);
this._updateCellsToRenderTimeoutID = null;
}
this._updateCellsToRender();
return;
} else {
this._updateCellsToRenderBatcher.schedule();
if (this._updateCellsToRenderTimeoutID == null) {
this._updateCellsToRenderTimeoutID = setTimeout(() => {
this._updateCellsToRenderTimeoutID = null;
this._updateCellsToRender();
}, this.props.updateCellsBatchingPeriod ?? 50);
}
}
}

Expand Down

0 comments on commit c8a387c

Please sign in to comment.