Skip to content

Releases: JonAbrams/SpaceAce

Better support for older browsers

21 Apr 03:17
Compare
Choose a tag to compare

Just some small compatibility fixes for old browsers.

Fixes

30 Jul 03:24
Compare
Choose a tag to compare

Thanks to @lifeiscontent for fixing an IE compatibility issue.

Also updated some dependencies that were flagged as potential security vulnerabilities.

Bound values for custom actions

18 Feb 19:20
Compare
Choose a tag to compare

With this release, SpaceAce adds native support for bound values. Before this version, you had to use .bind, but this has issues with TypeScript and is a bit too verbose. Now you can pass extra values along with the custom action to the space to bind the values.

e.g.

<div>
  <button onClick={space(handleClick, 'submit')}>Submit</button>
</div>

function handleClick({ merge },  clickType, event) {
  console.log(clickType); // submit
  
}

Middleware support

25 Dec 21:35
Compare
Choose a tag to compare

Merry X-Mas! The most requested feature of SpaceAce finally lands, and in SpaceAce fashion it's a bit unconventional.

I've been asked many times when SpaceAce would get Middleware support. I looked at how Redux did Middleware, and it of course felt far too user unfriendly for SpaceAce. It took a while, but I think I've come up with a SpaceAcey way to do middleware. It's done by super-charging subscribers.

What is middleware for? What's the easiest way to enable developers to do what's needed, while keeping the library itself as simple as possible? As far as I can tell, Middleware is used for a few things:

  1. Cancelling a change.
  2. Altering a change.
  3. Side effects caused by a change, e.g. logging, triggering an async request, etc.

The third case was already being taken care of by subscribers. With this latest release, subscribers can also cancel a change or alter it.

To cancel a change, have your subscriber call the passed in cancel function. When you do this, no further subscribers will be invoked, and not parent space subscribers will be called either.

To alter a change, have your subscriber return an object that should be used instead. This new object will be turned into a space, inserted at the appropriate spot in the tree, and further subscribers will be called, with the new space instead.

Check out the details in the updated Readme.

Cheers!
-Jon