Skip to content

Allow context to return a promise #206

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

Closed
wants to merge 2 commits into from
Closed

Allow context to return a promise #206

wants to merge 2 commits into from

Conversation

arafel
Copy link

@arafel arafel commented May 21, 2021

I'm using a function to return a global context, and it needs to look up some things asynchronously. I found that Vision wasn't resolving the promise before continuing with render.

The change I've made fixes that, and the test suite still passes. I'm aware of #177, but that seems to be a wider issue (and has been going on for a while!). Please would you consider merging this?

Thanks!

@wswoodruff
Copy link
Contributor

wswoodruff commented May 23, 2021

@arafel

Thank you for your work for this PR

Updating to async / await is a longstanding issue with vision because there's a lot of work involved, but we're working on it piecemeal starting with #205, which is a rebase of #177

Your message and PR reminded me we gotta get that settled and I pushed for merging it in the hapi hour Slack — hopefully it'll get merged soon!

@wswoodruff
Copy link
Contributor

Are there any other vision functions you'd like to be async? We can collaborate on dividing up the work if you'd like to contribute

Co-authored-by: william woodruff <williamswoodruff@gmail.com>
@arafel
Copy link
Author

arafel commented May 23, 2021

Thanks - I didn't know you could wait on concrete objects like that. Learning something new every day. :-)

I don't have anything else that I need async yet. Is the plan to wait and do the whole of vision in one go, or is it possible to async-ify it a bit at a time?

@wswoodruff
Copy link
Contributor

We're going for it a bit at a time — starting with the issue you're addressing here — #205 just got merged! @hapi/vision v6.1.0 should be released to npm shortly 😄

@wswoodruff
Copy link
Contributor

Alright v6.1.0 with async context support is now on npm does that solve this issue for you @arafel?

@arafel
Copy link
Author

arafel commented May 25, 2021

Hi @wswoodruff - I've just tested 6.1.0 and it works fine with my async context code. Much obliged, thank you. :-)

@arafel arafel closed this May 25, 2021
@arafel arafel deleted the async_context branch May 25, 2021 14:52
@Nargonath
Copy link
Member

Thanks @wswoodruff for following that up.

@Nargonath Nargonath added the non issue Issue is not a problem or requires changes label May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non issue Issue is not a problem or requires changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants