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

Add onValidated support to safeReference #1540

Merged
merged 1 commit into from
Nov 9, 2020
Merged

Add onValidated support to safeReference #1540

merged 1 commit into from
Nov 9, 2020

Conversation

getkey
Copy link
Contributor

@getkey getkey commented Jun 28, 2020

So you can do, just like you would do with a normal reference:

types.safeReference(Entity, {
    onInvalidated(ev: any) {
        console.log('fancy', ev);
    }
})

`[mobx-state-tree] Failed to resolve reference '${this.identifier}' to type '${
this.targetType.name
}' (from node: ${node.path})`
`[mobx-state-tree] Failed to resolve reference '${this.identifier}' to type '${this.targetType.name}' (from node: ${node.path})`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not change this, prettier did 😉

@getkey
Copy link
Contributor Author

getkey commented Nov 9, 2020

Hey @jesse-savary and @orlovcs, how does this look? 🙂

Copy link
Member

@jesse-savary jesse-savary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@orlovcs orlovcs merged commit 3c92314 into mobxjs:master Nov 9, 2020
@getkey
Copy link
Contributor Author

getkey commented Nov 9, 2020

Amazing! Thank you ❤️

@getkey getkey deleted the oninvalidated-safereference branch November 9, 2020 21:17
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.

3 participants