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

Await overriden functions when returning promises #425

Merged
merged 1 commit into from
Jun 28, 2022

Conversation

ghusse
Copy link
Contributor

@ghusse ghusse commented Jun 28, 2022

According to ember's documentation, the function beforeModel on routes can return Promises.

The previous implementation of ember-apollo-client did not allow to correctly use both async beforeModel & @queryManager on a route. Because of the override done by the plugin, it was not possible to await for the result of a beforeModel method.

With this fix,

  • when a hooked function returns a Promise, a promise is returned by the hooked function, allowing to wait for its completion.
  • when a hooked function does not return a Promise, it works as before.

Copy link

@Thenkei Thenkei left a comment

Choose a reason for hiding this comment

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

  • ✅ Code review
  • ✅ Automatic tests
  • ✅ Manual tests
  • ❔  PR title - I don't know the convention naming used

@josemarluedke josemarluedke merged commit 8adf15a into ember-graphql:master Jun 28, 2022
@josemarluedke
Copy link
Member

Thank you @ghusse . Published in v4.1.0.

@ghusse
Copy link
Contributor Author

ghusse commented Jun 29, 2022

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants