Migration from 2.x to 3.x
This is a crash guide to updrage RocketJump from version 2.x
to 3.x
version.
rj()
to rjPlugin()
#
Rewrite custom plugin from If you have written custom plugin simply replace the plugin code from using
rj()
to rjPlugin()
.
If you use core plugins are alredy converted.
From v2:
To v3:
#
No more plugin computedComputed are no more availables on plugins so if you use plugins that provide
computed you should specify them manually.
The following examples are tired to RocketJump core plugins the same thoughs can be applied to your custom plugin.
rjPlainList
#
From v2:
To v3:
To have the same computed on RjObject.
rjList
#
From v2:
To v3:
To have the same computed on RjObject.
@mutation
computed#
No more special The special '@mutation'
computed was removed.
To use mutations state you should write your selectors or better provide
inline computed.
From v2:
To v3:
tip
If you want to save time and you love regex you can use find-replace with the following regex:
Find:
('|")@mutation\.(.+)('|")
Replace:
s => s.mutations.$2
#
Selectors use all state instead of root stateIn RocketJump v2 the state can change shape depending on your mutation confiuration, but you selector was only related to root state:
In v2:
In v3 the selector shape is:
If you use RocketJump selectors your code still working.
The code below works bot in v2 and v3.
While this code is break in v3:
You can fix it by adding root
or using RocketJump selectors.
This is the code translated for v3:
#
Selectors and actions enhancersIn v2 you can write it as:
In v3 you can ONLY use this syntax (the most used):
#
Compose reducer initIn version 2.x the composeReducer
ins't a simple composition utility, but it
merge the inital values of provided composed function, since v3 composeReducer
simply
compose reducers.
In v2:
In v3:
You can achieve the same result by doing:
makeAction
to makeEffectAction
#
Rename The makeAction
name was too generic and confusing the only reason you have to
use this helper is works with side effect we renamed it to makeEffectAction
.
From v2:
To v3:
#
Change behaviour of custom effect actionIn version 2.x all custom effect action are always dispatched to reducer. Es:.
In v2:
In v2 calling actions.bu()
was supposed to be dispatched in reducer
.
Since v3 you have to manually handle how 'BU'
type side effect is handled.
To simple dispatch it on reducer the code should be something like:
We also change the custom takeEffect
signature to TakeEffectHanlder
:
rj.configured()
#
Deprecated We deprectated the syntax in favor of simply rj.configured()
'configured'
string
when setting the effectCaller
option.
From v2:
To v3: