Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pdfowler
Copy link

@pdfowler pdfowler commented May 1, 2018

I've started migrating my project to Mobx v4 (v4.2.0) and have run into some issues along the way. The main issue I've found in rfx-core is that the @toggle decorator no longer works.

In v4, the @observable decorator moves the prop from the class to the instance. Since @toggle decorates the class, an issue arises that throws an error preventing further page loading.

Error: [mobx] Property 'isOpen' of '[object Object]' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner

From the mobx gitter channel:

Michel Weststrate @mweststrate 12:15
@pdfowler yeah decorators don't compose atm, as @observable etc will redefine the property and move it from the class to the instance. Which unfortunately cannot be expressed neatly in the current decorators implementations (the current stage 2 proposal fixes that)

TODO:

  • Re-Implement @toggle to be compatible with mobx-4
  • Confirm that @extend works as intended

@foxhound87
Copy link
Owner

@pdfowler sorry I removed the @toggle decorator completely.

@foxhound87
Copy link
Owner

@foxhound87 foxhound87 closed this May 2, 2018
@pdfowler
Copy link
Author

pdfowler commented May 2, 2018

@foxhound87 Removing the decorator will break backward compatibility rather than deprecating it. Did you roll to a new major version?

As a quick example of the impact of this, were I not upgrading to mobx 4 at this time, I would have 80 instances of @toggle across 63 files that are suddenly broken if I had a semver string of "^1.5.3".

As it is, I am upgrading, so I need to reimplement these anyway, but this could have quite an impact on anyone who relies on this package

@foxhound87
Copy link
Owner

@pdfowler I understand your point, sorry for this.

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

Successfully merging this pull request may close these issues.

2 participants