Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

md-chips causes stack overflow when data objects have circular references #5778

Closed
@rich-j

Description

@rich-j

The <md-chips> and <md-contact-chips> directives can cause a stack overflow when the data objects have a circular reference. This worked up until RC2 when this fix(md-chips): appendChip disallows identical objects #4479 changed MdChipsCtrl.prototype.appendChip by adding a call to angular.equals() which doesn't support circular references. Here is a codepen (http://codepen.io/rich-j/pen/RWvymm?editors=101) that shows the issue. Try adding another "person" to the contact chips.

Angular's equals() function has several unimplemented requests for circular reference support:

Each "person" in our system is a single object that has references to related objects (e.g. parent/child, owner/member). We would like to pass these "person" instances directly to <md-contact-chips>. The Angular equals() function does work for object equality (i.e. same object references) however for unequal objects it can get stuck in a cycle since it unfortunately implements a depth first search on object properties.

Metadata

Metadata

Assignees

Labels

P1: urgentUrgent issues that should be addressed in the next minor or patch release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions