XLNT / gnarly

🤙 A blockchain ETL tool to make your life better. Now that’s fuckin’ gnarly.
https://xlnt.co
Apache License 2.0
119 stars 9 forks source link

Key containing "/" #46

Open nionis opened 6 years ago

nionis commented 6 years ago

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 commented 6 years ago

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.