Skip to content

1.19.0 - Async fixes and useDefer

Choose a tag to compare

@lostpebble lostpebble released this 10 Oct 15:09
· 56 commits to master since this release

(Unfortunately I skipped 1.18.0 by mistake...)

Some internal fixes for Async Actiosn and a new deferred way to run and watch action state

AsyncAction.useDefer()

You can now now use Async Actions with a method called useDefer(). This method allows you to defer the execution of an action in a later trigger further down inside your component or its children. What's really nice about this is that you don't need to know the arguments beforehand, as you do with the regular action use. This is great for listening to tasks and showing state in a parent component, which is triggered further down in a child component (such as button click on "Update User" or some kind of form submit).

const deferredAction = UpdateUser.useDefer();

// ... somewhere later or in another component

<button onClick={() => defferedAction.execute(newUserData)}>Update User</button>

This simplifies a lot of scenarios with Async Actions.