Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

cannot shorten array or change all of it atomically #6

@az143

Description

@az143

my model contains an array of plain string values. with deep-model i cannot shorten the array, only modify existing elements or add new ones to it.

mymodel.set({"arrayname":["val1","val2"]}) will ensure that val1 and val2 are the first two values, but nothing more. it does not do anything about the other values that the array may already contain.

this is caused by objToPath() in set translating my atomic set request into two independent requests for arrayname.0 and arrayname.1.

the only workaround that i can think of at this time is to model.set({"arrayname":null}) first to destroy the array, then rebuild it with the desired elements with a second model.set().
if anybody has a better idea i'd be grateful to hear it.

regards
az

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions