Skip to content

Model.set wiping out other properties in the model #21

@vijayst

Description

@vijayst

After an update API action, I am using Model.set({ modelJson: attributes }) as follows.

update(attributes = {}) {
    API.requestHeaders[HEADER_SESSION_TOKEN] = authProvider.fetchToken();
    return API.request({
      method: "put",
      data: { resource: [attributes] },
      endpoint: this.urlRoot,
      onSuccess: (response) => {
        console.log(this.detail);
        this.set({ modelJson: attributes });
        console.log(this.detail);
      }
    });
  }

This is wiping out all the other properties.

In attributes, I passed in "id" and "name". The console.log before and after the set is shown below.

screen shot 2016-10-11 at 3 49 56 pm

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions