Skip to content

Allow disabling object merge behavior #5597

Closed
@mrclay

Description

@mrclay

Our team has been bitten many times by the quirky merge behavior:

obj.set('foo', {one: 1, two: { a: 'a', b: 'b' }});
await obj.save(null);

obj.set('foo', {two: { b: 'b' }});
await obj.save(null);

console.log(obj.get('foo')); // { one: 1, two: { b: 'b' }}

First-level keys in attribute objects cannot be removed, only set to null. We have to completely unset('foo'), save, and re-set it to be assured it has the exected value.

This behavior isn't documented in Object.set.

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