-
Notifications
You must be signed in to change notification settings - Fork 112
Collect renderings on context specified in WorkflowLayout.take #1424
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
base: main
Are you sure you want to change the base?
Conversation
e370e97 to
86bc859
Compare
| "Collection dispatch should happen on the lifecycle's dispatcher." | ||
| withContext(collectionContext) { | ||
| require(Looper.myLooper() == Looper.getMainLooper()) { | ||
| "Collection dispatch should happen on the main thread!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/should/must
| * @param [collectionContext] additional [CoroutineContext] we want for the coroutine that is | ||
| * launched to collect the renderings. This should not override the [CoroutineDispatcher][kotlinx.coroutines.CoroutineDispatcher] | ||
| * but may include some other instrumentation elements. | ||
| * launched to collect the renderings, can include a different dispatcher - but it should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested wording: "can include a different dispatcher - but we verify that it's a main thread dispatcher" And maybe explain why this restriction exists (naively I thought all of this stuff was immutable so it'd be safe to access them from any thread)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is not for the runtime actually, this is where we collect the emitted renderings from the runtime and update the views that show them.
so we need to get main thread here to update those views.
The wording change is good though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...but we verify that it is a main thread dispatcher since we are updating views here!
| unoriginal.show(BScreen(), env) | ||
| } | ||
|
|
||
| @Test fun usesLifecycleDispatcher() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any test coverage now? If you took out the withContext statement and just ran the block directly would any test fail? (If not, I think we should test that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test coverage for this, and testing also that we throw if its not a main thread dispatcher in the context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops. Firebender had its own branch for the work we were doing and it did not get added.... stay tuned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, added correctly now.
6badc8d to
7a813e0
Compare
7a813e0 to
0d757f2
Compare
No description provided.