prodo-dev / prodo

Prodo is a React framework to build apps faster.
https://docs.prodo.dev
MIT License
115 stars 5 forks source link

Local plugin: setting nested value does not get saved to local storage #149

Closed coffee-cup closed 4 years ago

coffee-cup commented 4 years ago

In the local plugin action ctx, ctx.local is a proxy that will update the browsers local storage whenever anything on it changes. However, updating anything nested on ctx.local will not update browser local storage.

For example,

const myAction = () => {
  local.a.b = "foo";
}

will not update local storage, but

const myAction = () => {
  const a = local.a;
  a.b = "foo";
  local.a = a;
}

will

coffee-cup commented 4 years ago

Closed via #158