valtio-define 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +2 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -49,7 +49,8 @@ function set(obj, path, value) {
49
49
  function proxyWithPersistent(initialObject, options = {}) {
50
50
  options.key = options.key || generateStructureId(initialObject);
51
51
  const storage = options.storage || (typeof localStorage !== "undefined" ? localStorage : void 0);
52
- const state = proxy(tryParseJson(storage?.getItem(options.key)) || initialObject);
52
+ Object.assign(initialObject, tryParseJson(storage?.getItem(options.key)));
53
+ const state = proxy(initialObject);
53
54
  subscribe(state, () => {
54
55
  const paths = options.paths || Object.keys(state);
55
56
  const statePaths = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valtio-define",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "description": "⚡quickly create a fully functional and robust Valtio factory",
6
6
  "author": "Hairyf <wwu710632@gmail.com>",
7
7
  "license": "MIT",