Skip to content

Side effect that depends upon asynchronous value #41

Closed Answered by GregoryConrad
busslina asked this question in Q&A
Discussion options

You must be logged in to vote

I suppose we can not do use.asResource after doing await (twice).

Correct, you cannot have an await anywhere in the call-args of a side effect because that means the side effect will execute once the arguments finally resolve (which will then be across an async gap).

Will be the following a good solution?

I might suggest hoisting the use(rootBashrcTaggedFileUtility) above all of the awaits for readability purposes (up near getConnection), but yes, that is likely exactly how I would implement that workaround.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@busslina
Comment options

@GregoryConrad
Comment options

Answer selected by GregoryConrad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants