Skip to content

Commit

Permalink
Reorder prepareForRecycle before adding recycle pool (#24025)
Browse files Browse the repository at this point in the history
Summary:
Put `prepareForRecycle` to last before enqueue to recycle pool, ensure only call it when count lower than RCTComponentViewRegistryRecyclePoolMaxSize.

cc. shergin .

[General] [Changed] - Reorder prepareForRecycle before adding recycle pool
Pull Request resolved: #24025

Differential Revision: D14536843

Pulled By: shergin

fbshipit-source-id: 82a816e2c0afb5a6bb72637d7d55d6a4fda708af
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed Mar 20, 2019
1 parent e67aa42 commit a98f342
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions React/Fabric/Mounting/RCTComponentViewRegistry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ - (void)_enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandl
componentView:(UIView<RCTComponentViewProtocol> *)componentView
{
RCTAssertMainQueue();
[componentView prepareForRecycle];

NSHashTable<UIView<RCTComponentViewProtocol> *> *componentViews =
[_recyclePool objectForKey:(__bridge id)(void *)componentHandle];
if (!componentViews) {
Expand All @@ -218,6 +216,7 @@ - (void)_enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandl
return;
}

[componentView prepareForRecycle];
[componentViews addObject:componentView];
}

Expand Down

0 comments on commit a98f342

Please sign in to comment.