Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested includes leads to Error: "too much recursion" #167

Open
Chilinot opened this issue Jan 31, 2019 · 2 comments
Open

Nested includes leads to Error: "too much recursion" #167

Chilinot opened this issue Jan 31, 2019 · 2 comments

Comments

@Chilinot
Copy link

Hi, i have the following models:

  client.define('role', {
    name: '',
    displayname: '',
    service_authorizations: {
      jsonApi: 'hasMany',
      type: 'service_authorization'
    }
  })

  client.define('service', {
    name: '',
    displayname: '',
    service_authorizations: {
      jsonApi: 'hasMany',
      type: 'service_authorization'
    }
  })

  client.define('service_authorization', {
    name: '',
    displayname: '',
    service: {
      jsonApi: 'hasOne',
      type: 'service'
    },
    roles: {
      jsonApi: 'hasMany',
      type: 'role'
    }
  })

When trying to fetch the roles and its relationships i use the following:

      this.$authApiClient.findAll('role', { include: ['service_authorizations', 'service_authorizations.service'] })

But it crashes with the error in the title.

@Chilinot
Copy link
Author

The stacktrace:

InternalError: "too much recursion"
	resource webpack-internal:///./node_modules/devour-client/lib/middleware/json-api/_deserialize.js:65:1
	collection webpack-internal:///./node_modules/devour-client/lib/middleware/json-api/_deserialize.js:61:12
	collection webpack-internal:///./node_modules/devour-client/lib/middleware/json-api/_deserialize.js:60:10
	attachHasManyFor webpack-internal:///./node_modules/devour-client/lib/middleware/json-api/_deserialize.js:161:12
	attachRelationsFor webpack-internal:///./node_modules/devour-client/lib/middleware/json-api/_deserialize.js:137:16
	resource webpack-internal:///./node_modules/devour-client/lib/middleware/json-api/_deserialize.js:115:32
	createBaseFor webpack-internal:///./node_modules/lodash/_createBaseFor.js:17:11
	baseForOwn webpack-internal:///./node_modules/lodash/_baseForOwn.js:13:20
	forOwn webpack-internal:///./node_modules/lodash/forOwn.js:33:20
	resource webpack-internal:///./node_modules/devour-client/lib/middleware/json-api/_deserialize.js:100:3
 helpers.js:73

@Chilinot
Copy link
Author

Chilinot commented Feb 1, 2019

The issue is most likely that the two models ServiceAuthorization and Service both relate to each other and are both included in the response from the backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant