Raxol.Core.Runtime.ComponentManager (Raxol v2.0.1)

View Source

Refactored component manager with functional error handling patterns.

This module eliminates all try/rescue blocks and uses pure functional error handling with with statements and safe wrapper functions.

Key improvements:

  • 3 try/rescue blocks eliminated
  • Functional error composition with Task-based safety
  • Safe component operation wrappers
  • Proper error telemetry integration
  • Full backward compatibility maintained

Summary

Functions

Returns a specification to start this module under a supervisor.

Retrieves all components' data.

Retrieves a specific component's data by its ID.

Retrieves the current render queue and clears it.

Directly sets the state for a component (for testing purposes).

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

dispatch_event(event)

get_all_components()

@spec get_all_components() :: map()

Retrieves all components' data.

get_component(component_id)

@spec get_component(String.t()) :: map() | nil

Retrieves a specific component's data by its ID.

get_render_queue()

@spec get_render_queue() :: [String.t()]

Retrieves the current render queue and clears it.

mount(component_module, props \\ %{})

set_component_state(component_id, new_state)

@spec set_component_state(String.t(), map()) :: :ok | {:error, :not_found}

Directly sets the state for a component (for testing purposes).

set_runtime_pid(pid)

start_link(init_opts \\ [])

unmount(component_id)

update(component_id, message)