Skip to content

docs: add migration docs for mvvm to flowmvi#220

Open
anshu7vyas wants to merge 2 commits intorespawn-app:masterfrom
anshu7vyas:docs/mvvm-migration-flowmvi
Open

docs: add migration docs for mvvm to flowmvi#220
anshu7vyas wants to merge 2 commits intorespawn-app:masterfrom
anshu7vyas:docs/mvvm-migration-flowmvi

Conversation

@anshu7vyas
Copy link
Copy Markdown
Contributor

@anshu7vyas anshu7vyas commented Mar 31, 2026

Summary

  • Add comprehensive MVVM-to-FlowMVI migration guide with concept mapping, before/after code examples, UI layer migration (Compose, Compose Multiplatform, Android Views), incremental adoption strategy, and common challenges
  • Include PipelineContext explainer, MVI vs MVVM+ decision guide with Compose stability warning, expanded testing section with before/after comparisons, DI cross-reference, and Compose Multiplatform (KMP) section

Test plan

  • npm run build in docs/ passes with no errors
  • All 5 content additions (PipelineContext, Compose Multiplatform, DI tip, MVVM+ warning, testing expansion) verified in built HTML
  • Visual review: admonitions, tabs, and <details> blocks render correctly in browser
  • All internal cross-reference links resolve (di.md, compose.md, testing.md, android.md, savedstate.md)

Summary by CodeRabbit

  • Documentation
    • New Migration guide: detailed walkthrough for moving from Android/Kotlin MVVM to FlowMVI with concept mappings, full before/after examples, UI migration patterns for Compose and Android Views, incremental adoption guidance, and next-step links.
    • Added a new “Migration” documentation category and adjusted the ordering of the “Misc” documentation category.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b4c00dd8-784d-4167-ad64-f783db876ccd

📥 Commits

Reviewing files that changed from the base of the PR and between cd50cc8 and b65300d.

📒 Files selected for processing (2)
  • docs/docs/migration/mvvm.md
  • docs/docs/misc/_category_.json
✅ Files skipped from review due to trivial changes (2)
  • docs/docs/misc/category.json
  • docs/docs/migration/mvvm.md

📝 Walkthrough

Walkthrough

Adds a new "Migration" documentation category and a comprehensive MVVM→FlowMVI migration guide; also reorders the existing "Misc" category position.

Changes

Cohort / File(s) Summary
Migration Documentation
docs/docs/migration/_category_.json, docs/docs/migration/mvvm.md
Added a migration category config (position: 5, label: "Migration", collapsible: true, collapsed: false) and a detailed MVVM→FlowMVI guide with concept mappings, before/after code examples, UI migration patterns (Compose & Views), incremental adoption advice, and common challenges.
Misc Category Reorder
docs/docs/misc/_category_.json
Updated position from 4 to 6 to accommodate the new Migration category.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Poem

🐰 I hopped from ViewModel to a brighter view,
Mapping states and actions, tidy and new.
Immutable beats, intents that sing,
A little leap—FlowMVI spring! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: adding documentation for migrating from MVVM to FlowMVI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive migration guide from MVVM to FlowMVI, including a new category definition and a detailed markdown document. The guide covers concept mapping, side-by-side code comparisons, UI integration for Compose and Android Views, and incremental adoption strategies. Feedback focused on maintaining consistency in the code examples by standardizing the use of "BuildConfig.DEBUG" for build configuration references across the documentation.

Comment thread docs/docs/migration/mvvm.md
Comment thread docs/docs/migration/mvvm.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/docs/migration/mvvm.md`:
- Around line 367-377: The example uses ImmutableContainer<ProfileState,
ProfileIntent, ProfileAction> but then calls reduceLambdas(), which requires the
store's intent type to be LambdaIntent<ProfileState, ProfileAction>; change the
container/store intent type from ProfileIntent to LambdaIntent<ProfileState,
ProfileAction> so the types align (update the ImmutableContainer generic and any
usages like store.intent / loadProfile to use LambdaIntent), keeping
reduceLambdas(), lazyStore, and other symbols (ViewModel, lazyStore, store,
reduceLambdas, ImmutableContainer, ProfileState, ProfileAction) intact.
- Around line 128-133: The examples use unqualified sealed-class members (e.g.,
ClickedLoad, ClickedSave, ShowToast, Loading, Error, DisplayingProfile) which
prevents copy-paste compilation; update all occurrences to fully qualify them
with their enclosing sealed class names (e.g., ProfileIntent.ClickedLoad,
ProfileIntent.ClickedSave, ProfileAction.ShowToast, ProfileState.Loading,
ProfileState.Error, ProfileState.DisplayingProfile) so each match expression and
when branch references the exact symbol; apply this consistently across the
reduce, action, and state example blocks to ensure the snippets compile without
extra imports.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6fd92127-bc81-4d7f-bbba-abd825055aeb

📥 Commits

Reviewing files that changed from the base of the PR and between dfd213a and cd50cc8.

📒 Files selected for processing (2)
  • docs/docs/migration/_category_.json
  • docs/docs/migration/mvvm.md

Comment thread docs/docs/migration/mvvm.md Outdated
Comment thread docs/docs/migration/mvvm.md Outdated
Copy link
Copy Markdown
Member

@Nek-12 Nek-12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty good start, but this needs some human, non-ai love, and yes I had a pretty specific vision that i should have explained better beforehand. But this should be gtg after this one pass.

P.S. noticed CI is failing for some reason. I'll fix it on master.

Comment thread docs/docs/migration/mvvm.md Outdated

| MVVM | FlowMVI | Notes |
|------|---------|-------|
| `ViewModel` | `Container` / `ViewModel` implementing `ImmutableContainer` | You can keep your ViewModels on Android |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ViewModels are kmp, so we should remove "keep on android" and just leave "you can keep VMs or use ContainerViewModel.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in b65300d

Comment thread docs/docs/migration/mvvm.md Outdated
Comment thread docs/docs/migration/mvvm.md Outdated
Comment thread docs/docs/migration/mvvm.md Outdated
| `StateFlow.value` | `withState {}` | Thread-safe read access |
| Exposed `StateFlow` | `store.subscribe()` / Compose `subscribe {}` | Lifecycle-aware |
| Public ViewModel functions | `MVIIntent` sealed classes or `store.intent {}` lambdas | Choose one style per project |
| `SharedFlow` / `Channel` events | `MVIAction` side effects | Guaranteed delivery with `Distribute()` |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"MVIAction side effects" should say "action()" and consume when subscribing or smth similar. types are noise, we should point to functions that enable functionality. ditto everywhere in table

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in b65300d

Comment thread docs/docs/migration/mvvm.md Outdated
| Public ViewModel functions | `MVIIntent` sealed classes or `store.intent {}` lambdas | Choose one style per project |
| `SharedFlow` / `Channel` events | `MVIAction` side effects | Guaranteed delivery with `Distribute()` |
| `init {}` block | `init` plugin | Runs each time the store starts |
| `viewModelScope.launch {}` | Logic in `reduce {}`, `init {}`, `whileSubscribed {}` | Structured pipeline |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's wrong, we have PipelineContext.launch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in b65300d

Comment thread docs/docs/migration/mvvm.md Outdated

:::warning

`LambdaIntent` is a value class wrapping a lambda, which makes it inherently unstable for the Compose
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong, the problem is not the instability of lambda intents, it's the instability and proliferation of doThis and doThat functions that are legacy from MVVM style (which ARE unstable).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected in b65300d

Comment thread docs/docs/migration/mvvm.md Outdated

### 5. Add plugins incrementally

Start with the essentials — `reduce`, `recover`, `init` — then layer in more as needed:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong, we should explain that once people set up DI, they should just create a reusable configuration to never remember about enableLogging crap again. And whileSubscribed is NOT optional - must be used day one. metrics shill is overkill here, we should mention more useful things.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed metrics shill, updated in b65300d

Comment thread docs/docs/migration/mvvm.md Outdated
Comment thread docs/docs/migration/mvvm.md
Comment thread docs/docs/migration/mvvm.md Outdated
@anshu7vyas
Copy link
Copy Markdown
Contributor Author

@Nek-12 thank you for the detailed review, I have addressed all the comments and updated the doc as per your review. Please let me know if you have any further improvements/fixes in mind.

@anshu7vyas anshu7vyas requested a review from Nek-12 April 6, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants