-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code inside a withCol() block should not modify the UI, as it runs on a background thread. withCol() should fetch and/or mutate collection data, and then UI operations/program state changes should be performed outside the withCol block, so they're serialized on the main thread and the risk of race conditions is minimized. Recently mentioned on #13886 (comment) launchWithCol() makes it a bit too easy to accidentally run UI code in the background thread, as it provides both an async context and a collection at the same time, and the user will be tempted to do both fetch-from-col and update-UI steps inside the block. Removing it means a few extra characters at each call site, but I think it's a bit less error-prone.
- Loading branch information
Showing
4 changed files
with
10 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters