Skip to content

Unable to update a value once you have set it once #1

@andrewsnowden

Description

@andrewsnowden

Hey,

So we ported some of this to use on Android phones but this line seems to be wrong:

const nextTree = { [key]: JSON.parse(value), ...tree }

If you already have the key in your existing tree, then it will just overwrite your new value. So you can write a value once, but then you can never update it again.

Suggestion is to use something like

const nextTree = Object.assign({}, tree, {key: JSON.parse(value)})

Or even a simple assign if you don't mind it being mutated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions