Skip to content

Phase 4: Runtime and LiveView Integration - #8

Merged
pcharbon70 merged 7 commits into
mainfrom
feature/phase-4-runtime-and-liveview-integration
Mar 19, 2026
Merged

pcharbon70 merged 7 commits into
mainfrom
feature/phase-4-runtime-and-liveview-integration

Conversation

@pcharbon70

Copy link
Copy Markdown
Collaborator

Summary

Implements the LiveView integration layer that manages screen lifecycle, session state, and event handling.

Section 4.1 - LiveView Mount Integration

  • AshUI.LiveView.Integration with mount_ui_screen/3
  • Screen authorization on mount
  • Screen compilation to IUR
  • Binding evaluation for initial render
  • AshUI.LiveView.Hooks for lifecycle management

Section 4.2 - LiveView Update Integration

  • Subscribe/unsubscribe to Ash resource change notifications
  • Handle resource change notifications (created, updated, destroyed)
  • Re-evaluate affected bindings on notification
  • Batch multiple updates for performance
  • Cleanup subscriptions on unmount

Section 4.3 - Event Handling Integration

  • Event routing to appropriate handlers
  • Value change events (phx-blur, phx-change)
  • Action events (phx-click, phx-submit)
  • Event data validation
  • Wire handlers for screen bindings

Section 4.4 - Screen Lifecycle Management

  • Lifecycle hooks (on_init, on_update, on_unmount, on_error)
  • Session initialization with unique IDs
  • State isolation between LiveView sessions
  • Session-specific state storage
  • User-defined lifecycle callbacks

Section 4.5 - Error Handling and Recovery

  • Compilation error handling
  • Binding error handling with fallback values
  • Action error handling with flash feedback
  • Authorization error handling
  • Runtime error handling with stacktraces
  • Recovery strategies (retry, fallback, skip, abort)
  • Retry with exponential backoff

Section 4.6 - Integration Tests

  • Mount lifecycle integration scenarios
  • Event handling integration scenarios
  • Reactivity integration scenarios
  • End-to-end screen lifecycle tests
  • Session management tests
  • Telemetry event tests

Test plan

  • All mount integration tests pass
  • All update integration tests pass
  • All event handling tests pass
  • All lifecycle management tests pass
  • All error handling tests pass
  • Integration tests validate end-to-end scenarios

Implemented screen mounting through LiveView mount/3 callback:
- AshUI.LiveView.Integration module with mount_ui_screen/3
- Screen authorization on mount with policy checking
- Screen compilation to IUR on initial mount
- Binding evaluation for initial render
- AshUI.LiveView.Hooks for lifecycle management
- on_mount, on_update, on_unmount hooks
- User-defined lifecycle callbacks
- Telemetry events for mount operations
- Tests for mount integration and hooks
Implemented reactive updates through LiveView handle_info/2 callback:
- Subscribe/unsubscribe to Ash resource change notifications
- Filter notifications to bound resources
- Handle resource change notifications (created, updated, destroyed)
- Re-evaluate affected bindings on notification
- Batch multiple updates for performance
- Cleanup subscriptions on unmount
- Tests for update integration
Implemented UI event handling through LiveView handle_event/3:
- Event routing to appropriate handlers based on type
- Value change events (phx-blur, phx-change)
- Action events (phx-click, phx-submit)
- Event data validation
- Error handling with flash messages
- Wire handlers for screen bindings
- Tests for event handling
Implemented screen lifecycle hooks and state management:
- Lifecycle hooks (on_init, on_update, on_unmount, on_error)
- Session initialization with unique IDs
- State isolation between LiveView sessions
- Session-specific state storage
- User-defined lifecycle callbacks
- Session cleanup on disconnect
- Telemetry events for lifecycle tracking
- Error handling during lifecycle
- Tests for lifecycle management
Implemented error handling for runtime failures:
- Compilation error handling with user-friendly messages
- Binding error handling with fallback values
- Action error handling with flash feedback
- Authorization error handling
- Runtime error handling with stacktraces
- Recovery strategies (retry, fallback, skip, abort)
- Retry with exponential backoff
- User-friendly error messages
- Error telemetry emission
- Tests for error handling
Added comprehensive integration tests for Phase 4:
- Mount lifecycle integration scenarios
- Event handling integration scenarios
- Reactivity integration scenarios
- End-to-end screen lifecycle tests
- Error recovery flow tests
- Session management tests
- Telemetry event tests
@pcharbon70
pcharbon70 merged commit c320d3d into main Mar 19, 2026
4 of 8 checks passed
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.

1 participant