Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Key containing "/" #46

Open
nionis opened this issue Aug 7, 2018 · 1 comment
Open

Key containing "/" #46

nionis opened this issue Aug 7, 2018 · 1 comment

Comments

@nionis
Copy link
Contributor

nionis commented Aug 7, 2018

Issue:

State is not updated in the DB

Why:

There is unexpected behaviour when a key in state contains "/", due to the way JSON patches work "/" determines the path in a JSON patch.

Example:

// reducer function
updateState = (id, value) => {
  console.log(id)
  // "eth/usd" (contains "/")

  state[id].value = value
  // state will not update
}

Solution:

Don't use "/" in a key

@shrugs
Copy link
Member

shrugs commented Aug 9, 2018

We should add developer warning, sort of how react does

const warn = (msg) => process.env.NODE_ENV !== 'production' && debug(msg)

and then warn about things like this; good catch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants