Skip to content

Commit

Permalink
Remove treeId parameter from buildDefaultLithoConfiguration
Browse files Browse the repository at this point in the history
Summary: This parameter seemed to always take the same value, so we are removing it to not allow clients to specify and mess it up on the way.

Reviewed By: adityasharat

Differential Revision: D51195885

fbshipit-source-id: 856317f3de0f9941cebdad7cec53015153a1877d
  • Loading branch information
Fabio Carballo authored and facebook-github-bot committed Nov 13, 2023
1 parent 6164b91 commit bdfc1ea
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected ComponentContext(
mLithoConfiguration =
lithoConfiguration != null
? lithoConfiguration
: buildDefaultLithoConfiguration(mContext, null, null, null, -1);
: buildDefaultLithoConfiguration(mContext, null, null, null);

if (mLithoConfiguration.logger != null && mLithoConfiguration.logTag == null) {
throw new IllegalStateException("When a ComponentsLogger is set, a LogTag must be set");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ public static LithoConfiguration buildDefaultLithoConfiguration(
Context context,
final @Nullable VisibilityBoundsTransformer transformer,
@Nullable String logTag,
@Nullable ComponentsLogger logger,
int treeID) {
@Nullable ComponentsLogger logger) {
ComponentsLogger loggerToUse =
logger != null ? logger : ComponentsConfiguration.componentsLogger;

Expand All @@ -117,9 +116,7 @@ public static LithoConfiguration buildDefaultLithoConfiguration(
DefaultErrorEventHandler.INSTANCE,
logTagToUse,
loggerToUse,
treeID != ComponentTree.INVALID_ID
? new RenderUnitIdGenerator(treeID)
: null, // TODO check if we can make this not nullable and always instantiate one
null,
transformer,
null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ComponentTreeBuilderTest {
ComponentContext(
androidContext,
ComponentContextUtils.buildDefaultLithoConfiguration(
androidContext, null, LOG_TAG, null, -1),
androidContext, null, LOG_TAG, null),
null)

root = TestLayoutComponent.create(context).build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class LithoMetadataExceptionWrapperTest {
return ComponentContext(
androidContext,
ComponentContextUtils.buildDefaultLithoConfiguration(
androidContext, null, "myLogTag", null, -1),
androidContext, null, "myLogTag", null),
null)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LogTreePopulatorTest {
ComponentContext(
androidContext,
ComponentContextUtils.buildDefaultLithoConfiguration(
androidContext, null, "test", null, -1),
androidContext, null, "test", null),
null)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public SectionContext(Context context) {
public SectionContext(ComponentContext context) {
this(
context.getAndroidContext(),
buildDefaultLithoConfiguration(
context.getAndroidContext(), null, context.getLogTag(), context.getLogger(), -1),
buildDefaultLithoConfiguration(context.getAndroidContext(), null, null, null),
context.getTreePropsCopy());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LoggingActivity : NavigatableDemoActivity() {
ComponentContext(
this,
ComponentContextUtils.buildDefaultLithoConfiguration(
this, null, "LITHOSAMPLE", SampleComponentsLogger(), -1),
this, null, "LITHOSAMPLE", SampleComponentsLogger()),
null)

val lithoView =
Expand Down

0 comments on commit bdfc1ea

Please sign in to comment.