Skip to content
This repository was archived by the owner on Jul 7, 2026. It is now read-only.
This repository was archived by the owner on Jul 7, 2026. It is now read-only.

Set() with complex JSON overwrites rather than updating nested attributes #135

Description

@akshaddhoke

Backbone fetch() uses JSON to set the attributes once they are received, which is causing nested attributes to be overwritten rather than being updated.

I am not sure if this is by design, or a bug, but I was expecting the same behavior whether setting the values using '.' or by directly using a complex JSON.
E.g.
model.set('name.firstName','John') ----> only updates firstName of nested name attribute
model.set({name:{firstName:'John'}}); ----> replaces the nested name attribute

JsFiddle: http://jsfiddle.net/c2yjzs2u/1/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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