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

[v2] Save fail when using bind() in model constructor #218

Closed
1 of 3 tasks
svobik7 opened this issue Nov 11, 2020 · 1 comment
Closed
1 of 3 tasks

[v2] Save fail when using bind() in model constructor #218

svobik7 opened this issue Nov 11, 2020 · 1 comment

Comments

@svobik7
Copy link
Contributor

svobik7 commented Nov 11, 2020

Submitting a:

  • Bug report
  • Feature suggestion
  • Support request

When trying to update a model (previously fetched from server) I am getting TypeError: Cannot read property 'referenceDef' of undefined

This is because bound methods are included in Object.keys() but does not exists in datx fields. See below where code failes:

Screenshot 2020-11-11 at 15 12 22

Method is bound in class constructor like this:

Screenshot 2020-11-11 at 15 12 29

  • datx version - 2.0.0-beta.7
  • datx-jsonapi version - 2.0.0-beta.7

Steps to reproduce:

  1. add class method dummy() {} to your json api model
  2. bound this method in model constructor this.dummy = this.dummy.bind(this)
  3. save model
@svobik7 svobik7 changed the title Save fail when using bind() in model constructor [v2] Save fail when using bind() in model constructor Nov 11, 2020
svobik7 referenced this issue in svobik7/datx Nov 11, 2020
DarkoKukovec added a commit that referenced this issue Nov 11, 2020
@DarkoKukovec
Copy link
Member

This fix was published in version 2.0.0-beta.8
Thanks for the contribution!

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

2 participants