Skip to content

Cannot resolve a reference with multiple candidates (two model instances with same identifier) #1156

Description

@zisiszikos

Bug report

  • I've checked documentation and searched for existing issues
  • I've made sure my project is based on the latest MST version
  • Fork this code sandbox or another minimal reproduction.

Sandbox link or minimal reproduction code
Sandbox example

Describe the expected behavior
I have a Base model that is composed in two places one, two in the store tree. This model uses nested models Country and City. I add a new country and a new city in both places with the same identifiers. The cities are also placed in an array of references at the country model. Now I want to get the cities of a country by reading the list of cities references.

Describe the observed behavior
When trying to get the list of cities from references list of Country model, the following error throws:

[mobx-state-tree] Cannot resolve a reference to type 'late(function () {
    return City;
  })' with id: '1000' unambigously, there are multiple candidates: /one/cities/1000, /two/cities/1000

The same is NOT happening when trying to get a country, even though there are multiple countries with the same identifier, but not in a list of references.

It seams that resolving an item by its reference identifier not working if there are multiple items with the same identifier.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions