Skip to content

Commit

Permalink
Do not return released component trees in cached values
Browse files Browse the repository at this point in the history
Summary: Do not return released component trees in cached values

Reviewed By: fbcbl

Differential Revision: D67027304

fbshipit-source-id: fe64f5c9f6c0080146ca003ad1cf9399ff1e34f4
  • Loading branch information
jettbow authored and facebook-github-bot committed Dec 11, 2024
1 parent e92921a commit c3628fb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion litho-core/src/main/java/com/facebook/litho/ComponentTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -2532,7 +2532,19 @@ public void release() {
if (mReleased || mTreeState == null) {
return null;
}
return mTreeState.getCachedValue(globalKey, index, cachedValueInputs, isLayoutState);
Object cachedValue =
mTreeState.getCachedValue(globalKey, index, cachedValueInputs, isLayoutState);
if (ComponentsConfiguration.defaultInstance.enableVisibilityFixForNestedLithoView) {
// This is a temporary solution to solve the issue of visibility events for
// VerticalScrollComponentSpec and HorizontalScrollSpec. We can remove it after shipping the
// primitive version of VerticalScroll and HorizontalScroll
if (cachedValue instanceof ComponentTree) {
if (((ComponentTree) cachedValue).isReleased()) {
return null;
}
}
}
return cachedValue;
}

@VisibleForTesting
Expand Down

0 comments on commit c3628fb

Please sign in to comment.