Skip to content

[composable-controller] Make class and messenger generic upon child controllers #3627

Description

@MajorLift

Explanation

Currently, the allow lists of ComposableControllerMessenger are set to string, which is too permissive. Each ComposableController instance needs typing and allow lists that are specific to its set of input child controllers.

However, there's no simple way to achieve this using BaseController, as controller-messenger allow lists are defined for the controller class singleton, not controller instances.

Instead, ComposableController and ComposableControllerMessenger need to be made polymorphic upon the controllers constructor property, which represents the list of child controllers to be composed.

Requirements

  • A generic parameter ControllerList (or maybe ChildControllers) needs to be added to the ComposableController class and ComposableControllerMessenger type.
  • ControllerList should be constrained, but not defined by the least supertype for all base-controller instances (currently ControllerInstance).
  • ControllerList should be used to derive the return type of flatState() at the type level.
  • ControllerList should be used to derive the state type for ComposableController instances.
  • ControllerList should be used to derive the allow lists of ComposableControllerMessenger.
    • The allow lists should at minimum include the stateChange events for all child controllers that are subscribed to in the #updateChildController() method.

References

Activity

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

Metadata

Metadata

Assignees

Labels

team-wallet-frameworkDeprecated: Please use `team-core-platform` instead.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions