selfup / hyperapp-moisturize

HOA for Dynamically upgrading Hyperapps (HMR/Dynamic Import/Whatever)
https://codepen.io/selfup/pen/gooojE?editors=0010
MIT License
14 stars 2 forks source link

Nested actions #1

Open okwolf opened 6 years ago

okwolf commented 6 years ago

The current code you have for wiring newActions inside updateApp will only handle a single level of action functions contained in newActions, but not other nested objects to enable moisturizing actions within slices.

What ever naïve fool came up with this code should be fired 😂

selfup commented 6 years ago

Never thought about nesting actions, I'll look into it. And yea who did that 🤣

okwolf commented 6 years ago

In a medium-to-large app, it's likely you will be using state slices and will want actions to operate on those slices.

Particularly in the case of code splitting, if the functionality is independent enough that it can be loaded separately then the state could also be split out into its own slice.

Even for HMR, you would need this capability as soon as your app used slices in order to update your actions correctly.

One example of how to implement this is enhanceActions in @hyperapp/logger.