Previously the local plugin would only capture updates made to the top level of universe.local. So this would work (update universe and browser local storage)
local.a = "foo"
but this would not
local.a.b = "foo"
This PR makes the second example work. It also supports deleting of local storage items.
Instead of using a proxy to trap set calls to universe.local, I instead use the plugin onCompleteEvent hook to update local storage (if not in fixtures mode) with the new state of the universe and remove any values that were deleted. Some notable changes:
config.initLocal values are store in local storage
local storage is only read from once in init. This behaves more like local storage middleware for redux
Previously the local plugin would only capture updates made to the top level of
universe.local
. So this would work (update universe and browser local storage)but this would not
This PR makes the second example work. It also supports deleting of local storage items.
Instead of using a proxy to trap
set
calls touniverse.local
, I instead use the pluginonCompleteEvent
hook to update local storage (if not in fixtures mode) with the new state of the universe and remove any values that were deleted. Some notable changes:config.initLocal
values are store in local storage