Skip to content

fix(maui): recycling follow-ups from the v2.2.0 review - #54

Open
michaelstonis wants to merge 1 commit into
developfrom
fix/maui-recycling-follow-ups
Open

michaelstonis wants to merge 1 commit into
developfrom
fix/maui-recycling-follow-ups

Conversation

@michaelstonis

Copy link
Copy Markdown
Contributor

Why

Follow-ups from the review of v2.1.3...v2.2.0 for the opt-in recycled-row feature (#47).

What

  • RecycledItemViewLimit(0) no longer watches a list that never opted in. It created a watcher and a PropertyChanged subscription for a list that keeps nothing.
  • README — documents RecycledItemViewLimit: the default, what 5 corresponds to, which rows are kept, and which lifecycle hooks a kept row skips.
  • Tests — a list that has not opted in is not watched; RecycledItemViewLimit(0) on such a list does not watch it; opting in after rows are bound takes effect from their next recycle.
  • Test setup — MauiTestBase now derives from StellarTestBase, so every test class initialises ReactiveUI through UseStellarComponents. Before, two bases built it differently and the outcome could depend on which class ran first.
  • Corrects two comments that predate opt-in.

Left alone, deliberately

  • One WeakReference per item view on lists that have not opted in. Removing it means a table lookup on every parent change instead, which is no cheaper.
  • Parking allocated before the watcher can refuse: once per over-limit view, not per recycle.
  • If a kept row's view model is replaced while it is recycled, the replacement receives Deactivated before its first Activated, and the original receives none. Fixing it needs a change to ViewManager.OnLifecycle in the core library, and it only affects consumer view models implementing ILifecycleEventAware on an opted-in list.

Verification

  • Stellar.Maui.UnitTests: 198/198 locally on net10.0.
  • No device or emulator run.

🤖 Generated with Claude Code

…cument the option

Passing 0 to a list that had never opted in created a watcher and a
PropertyChanged subscription for a list that keeps nothing.

Adds the README section for the option, tests that a list which has not
opted in is not watched and that opting in after rows are bound takes
effect, and puts every MAUI test class through UseStellarComponents so
results cannot depend on which class initialises ReactiveUI first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 21:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation is narrowly scoped, consistent with existing watcher behavior, and covered by focused tests.

Review effort: Balanced
Findings: None

What changed in this PR

Refines MAUI recycled-row opt-in behavior, documentation, and test initialization.

Changes:

  • Avoids creating watchers when setting an unconfigured list’s limit to zero.
  • Adds coverage for watcher creation and late opt-in.
  • Documents recycling behavior and standardizes ReactiveUI test setup.
File Description
Stellar.Maui/​MauiViewManager.cs Clarifies non-opted-in recycling cost.
Stellar.Maui/​Extensions/​ItemsViewExtensions.cs Avoids unnecessary zero-limit watchers.
Stellar.Maui.UnitTests/​StellarTestBase.cs Documents shared ReactiveUI initialization.
Stellar.Maui.UnitTests/​MauiTestBase.cs Reuses the shared test base.
Stellar.Maui.UnitTests/​ItemsViewRecyclingTests.cs Covers watcher and late opt-in behavior.
README.md Documents recycled-row binding retention.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants