Skip to content

feat(runtime): page-scoped event bus, API disposal guards, storage cleanup - #2387

Merged
usmanvrtx merged 1 commit into
mainfrom
feat/storage-page-events
Oct 15, 2026
Merged

usmanvrtx merged 1 commit into
mainfrom
feat/storage-page-events

Conversation

@usmanvrtx

Copy link
Copy Markdown
Member

Description

This PR adds runtime support for model-specific page events, strengthens API and widget lifecycle handling, and storage improvements.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

What Has Changed

  • Added PageEventBus to support model-specific event handling.
  • Improved API disposal guards and widget rebinding behavior.
  • Updated storage behavior and added focused tests for the new runtime behavior.

How to Test

  1. Run flutter test test/page_event_bus_test.dart test/api_dispose_guard_test.dart test/ensemble_widget_rebind_test.dart test/storage_manager_test.dart from modules/ensemble.
  2. Run the TV focus tests from modules/ensemble: flutter test test/framework/tv/page_tv_header_test.dart test/widget/tv_focus_registry_index_test.dart test/widget/tv_focus_registry_test.dart test/widget/tv_focus_scroll_test.dart.
  3. Run the full flutter test suite from modules/ensemble.

Screenshots / Videos

Not applicable.

Checklist

  • I have run flutter analyze and addressed any new warnings
  • I have run flutter test and all tests pass
  • I have tested my changes on the relevant platform(s)
  • I have updated documentation if needed
  • My changes do not introduce new warnings or errors

…eanup

Ports the storage/event-bus work from fix/storage-optimization onto main,
without the TV / binding-owner changes that branch was stacked on.

- PageEventBus: page-scoped EventBus with a model-id index (onIndexed)
- PageData.isDisposed + onResponse/onError disposal guards in invoke_api_action
- PublicStorage.clearPublicStorage now uses Future.wait
- tests: page_event_bus_test, api_dispose_guard_test, storage_manager_test
- page_event_bus_binding_test: integration coverage ported from
  ensemble_widget_rebind_test.dart on fix/storage-optimization (2 assertions
  there depend on the binding-owner listenerMap teardown and are skipped)

scope.dart: isDisposed is only set when the page's root scope is disposed
(child scopes share the page bus, so disposing one must not mark the page).
@usmanvrtx usmanvrtx self-assigned this Oct 14, 2026

@sharjeelyunus sharjeelyunus left a comment

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.

LGTM

@usmanvrtx
usmanvrtx merged commit b8758b3 into main Oct 15, 2026
8 checks passed
usmanvrtx added a commit that referenced this pull request Oct 15, 2026
…tion

Brings in PR #2387 (page-scoped PageEventBus, API disposal guards, storage
cleanup).

Conflict resolved in modules/ensemble/lib/framework/scope.dart: kept the
branch's shared-resource dispose split and adopted the incoming isDisposed
semantics. pageData._disposed is set on the root-scope path only, because
child scopes already early-return and must not mark the page disposed. That
keeps PR #2387's API onResponse/onError disposal guards effective while
child-scope teardown still leaves the page alive.

The incoming PageEventBus model indexing applies unchanged in the branch's
_listenToBindingSource (the incoming change targeted the pre-branch method
name listen()).
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