Skip to content

Support States within the key parameter #157

@nvahalik

Description

@nvahalik

Currently the key option for the importing of the plugin only allows for State Tokens and strings. This causes an error (#123) if you pass in a StateModel.

It should be fairly easy to suppose a StateModel object since it has a name attribute which is the value that needs to be examined rather than the key itself.

for (const key of keys) {
    let val = nextState;
    if (key !== '@@STATE') {
        val = getValue(nextState, key);
    }
    try {
        this._asyncEngine.setItem(key, options.serialize(val));
    }
    catch (e) {
        console.error('Error ocurred while serializing the store value, value not updated.');
    }
}

Just check to see if the key is a StateModel and if it is, the "real name" is key.name rather than key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions