Remove LayoutViewFactory + refactor FeatureView to make it compose-first (first commit)#2
Remove LayoutViewFactory + refactor FeatureView to make it compose-first (first commit)#2iantybo wants to merge 1 commit into
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (35)
💤 Files with no reviewable changes (19)
📝 WalkthroughWalkthrough
ChangesCompose Rendering Migration
🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Mirror of the first commit of instacart/formula#511 for CodeRabbit review.
Head is
4fc15c1(the first commit of PR #511) against the same base commit (f8f1aa3) the original ran against.Original PR: instacart/formula#511
Risk Score: High - Possible Team Escalation Required
Summary
This PR represents a major architectural refactoring that eliminates Android View-based abstractions and establishes Jetpack Compose as the primary rendering mechanism. The changes remove two key abstraction layers (
LayoutViewFactoryandViewInstance), refactor the coreFeatureViewcomponent to be Compose-centric, consolidateComposeViewFactoryfrom a separate module into the main library, and update all affected samples and tests accordingly.Key Changes
Core Architectural Refactoring:
FeatureViewsignature completely changed fromFeatureView<RenderModel>(val view: View, val setOutput: (RenderModel) -> Unit)toFeatureView<RenderModel>(val content:@composable(RenderModel) -> Unit, val initialModel: RenderModel? = null), making Compose rendering the primary contractLayoutViewFactoryandViewInstanceentirely, eliminating the XML layout inflation abstractionFormulaFragmentnow uses Jetpack Compose interop directly: createsComposeView, manages state viaMutableState, and composes viafeatureView.content(state)Module Consolidation:
ComposeViewFactoryfrom separateformula-android-composemodule intoformula-androidformula-android-composemodule and its build configurationViewFactory.fromLayout()static factory and simplifiedViewFactory.Paramsto accept onlycontext(removedLayoutInflaterandViewGroup)Sample Updates:
RenderView-based Android views to Jetpack Compose, replacingTaskListRenderViewwithTaskListScreencomposableComposeViewFactoryfrom the relocated moduleTest Infrastructure:
TestViewFactoryrefactored to work with ComposeFeatureViewinstead ofLayoutViewFactoryFormulaFragmentTestto verify render exceptions are no longer routed toenvironment#onScreenErrorViewFactoryTest,ViewInstanceTest)Impact
This is a breaking change that eliminates multiple public APIs and requires consumers to:
LayoutViewFactoryimplementations withComposeViewFactoryViewFactory.Paramsusage to only passcontextViewInstance-based patterns to use Compose-based renderingThe refactoring is systematic and well-coordinated, with all related modules, samples, and tests updated in a single PR. However, the magnitude of breaking changes requires coordination with dependent projects and careful migration planning.