Skip to content

Need to dynamic actions in order to support code splitting #439

Description

@Pyrolistical

#435 showed its possible to write an HoA to encapsulate state+action+view into module and #435 (comment) showed its possible to load lazy said module, except for the module actions.

Motivation

Code splitting.

Problem

There is currently no way to add actions dynamically.

Possible Solutions

1. Include addAction action in app

  • solves the problem in the most direct way

2. Include loadModule action in app

  • solves the bigger issue at the same time

3. Merge the concepts of state and actions

  • state is expected to change, so what if we just put state and actions in the same place?
  • replace state and actions with root, keep view
  • allow root to hold both data and functions. functions would take in root and slice the tree as it does now
  • functions return and object which will merge into the subtree of where it lives, it can return both data and more functions (aka actions!)
  • since actions don't need to be there at init time, then modules don't need to exist either! modules can be put directly on the root or added during init or add lazily later

Option 3 is most interesting to me since it removes even more concepts from Hyperapp.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions