Phase 11.2.2 - Bounded Widget-Local State Infrastructure - #132
Merged
Conversation
Added widget-local state support to the runtime: - Runtime.State now includes widget_local_state map - widget_local_state/2 - Get widget-local state by identity - put_widget_local_state/3 - Set widget-local state - update_widget_local_state/3 - Update widget-local state with function - delete_widget_local_state/2 - Delete widget-local state for cleanup - handle_widget_event/2 - Route widget events to handle_widget_event callback Integration points: - Component.mount/1 now fetches and passes widget-local state to widgets - ScreenComponent handles "widget_component_event" events - Event routing converts string event names to atoms for callbacks Tests: - 14 new tests covering widget-local state CRUD operations - Tests verify state isolation, event handling, and error cases Completes Phase 11.2.2 requirement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the bounded widget-local state infrastructure for Phase 11.2.2. This allows widget components to own bounded local UI lifecycle and ephemeral state while remaining subordinate to server-authoritative screen or application state.
Added Functions:
Runtime.State
widget_local_state/2- Get widget-local state by widget identity keyput_widget_local_state/3- Set widget-local state for a widgetupdate_widget_local_state/3- Update widget-local state with a functiondelete_widget_local_state/2- Delete widget-local state (for cleanup)handle_widget_event/2- Route widget events to widget'shandle_widget_event/3callbackIntegration Points
LiveUi.Component.mount/1- Fetches and passes widget-local state to widget componentsLiveUi.Runtime.ScreenComponent- Handles"widget_component_event"events and updates widget-local stateError Types
Error.widget_event_failed/1- Widget event handler failedError.invalid_widget_event_payload/0- Invalid event payloadTests
widget_local_state_test.exscovering:All 169 tests pass (155 original + 14 new)
Completes Phase 11.2.2 requirement.