Releases: vigetlabs/microcosm
v12.7.0-alpha.4: Version 12.7.0-alpha.4
- Added
batch
as an option when instantiating Microcosm. When set to
true
, high frequency change events will be batched together using
requestIdleCallback
v12.7.0-alpha.3: Version 12.7.0-alpha.3
- Action status changing methods are auto-bound, and will warn when a
completed action attempts to move into a new state (strict mode only)
Version 12.7.0 Alpha 2
- The first argument of
repo.push
is passed into theopen
state of actions that return promises.
Version 12.6.1
- Corrected generator check to be resistant to minification
Version 12.5.0
- Added a
defaults
static to Microcosm that passes default options to the constructor and setup method. - The first argument of
setup
, the options object passed when instantiating a Microcosm argument, will always be an object. There is no need to handle the null case for options. - Added a strict mode build of Microcosm that ships with development assertions. See
installation.md
for more details
Defaults
We frequently pass custom options into Microcosm to configure Domains and Effects with different options based on the environment. For example, an Effect that auto-saves user data:
class Repo extends Microcosm {
setup ({ saveInterval }) {
// ...
this.addEffect(Autosave, { saveInterval })
}
}
It can be cumbersome to chase down the default options, which may be specified as defaults in individual domains/effects. With this release, you may now define defaults using the defaults
static:
class Repo extends Microcosm {
static defaults = {
saveInterval: 5000
}
setup ({ saveInterval }) {
// ...
this.addEffect(Autosave, { saveInterval })
}
}
This takes advantage of the Class Fields & Static Properties Spec. This specification is still at Stage 2, however it has become common place to use this feature within React projects. If living on the edge isn't your thing, defaults may also be configured by assigning a default
property to your Microcosm subclass:
class Repo extends Microcosm {
setup ({ saveInterval }) {
// ...
this.addEffect(Autosave, { saveInterval })
}
}
Repo.defaults = {
saveInterval: 5000
}
All Microcosm specific options, such as maxHistory
will get merged into your custom defaults upon construction.
v12.5.0-beta
- Added a
defaults
static to Microcosm that passes default options
to the constructor and setup method. - The first argument of
setup
, the options object passed when
instantiating a Microcosm argument, will always be an object. There
is no need to handle the null case for options. - Added a strict mode build of Microcosm that ships with development
assertions. Seeinstallation.md
for more details
Defaults
We frequently pass custom options into Microcosm to configure Domains
and Effects with different options based on the environment. For
example, an Effect that auto-saves user data:
class Repo extends Microcosm {
setup ({ saveInterval }) {
// ...
this.addEffect(Autosave, { saveInterval })
}
}
It can be cumbersome to chase down the default options, which may be
specified as defaults in individual domains/effects. With this
release, you may now define defaults using the defaults
static:
class Repo extends Microcosm {
static defaults = {
saveInterval: 5000
}
setup ({ saveInterval }) {
// ...
this.addEffect(Autosave, { saveInterval })
}
}
This takes advantage of
the
Class Fields & Static Properties Spec. This
specification is still
at Stage 2, however it
has become common place to use this feature within React projects. If
living on the edge isn't your thing, defaults may also be configured
by assigning a default
property to your Microcosm subclass:
class Repo extends Microcosm {
setup ({ saveInterval }) {
// ...
this.addEffect(Autosave, { saveInterval })
}
}
Repo.defaults = {
saveInterval: 5000
}
All Microcosm specific options, such as maxHistory
will get merged
into your custom defaults upon construction.
v12.4.0
v12.3.1
Version 12.2.1
- adding domains does not reset state
- patching parents with keys owned by children does not patch children
- patch does not reset state in forks
- new children props re-render presenters
- presenter.send method is autobound, allowing it work when passed to children