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

There is no need to call job.cancel() when we are using viewModelScope() #4603

Merged
merged 2 commits into from
Dec 1, 2021

Conversation

ariskotsomitopoulos
Copy link
Contributor

Fixing issue #4602

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

Unit Test Results

  66 files  ±0    66 suites  ±0   54s ⏱️ +6s
135 tests ±0  135 ✔️ ±0  0 💤 ±0  0 ±0 
418 runs  ±0  418 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 578a012. ± Comparison against base commit 2e52f42.

♻️ This comment has been updated with latest results.

@@ -233,7 +233,6 @@ class RoomDirectoryViewModel @AssistedInject constructor(
}

override fun onCleared() {
currentJob?.cancel()
super.onCleared()
Copy link
Member

Choose a reason for hiding this comment

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

I think we can do more cleanup by removing the fun (at both places)

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for removing the field as well

Copy link
Member

Choose a reason for hiding this comment

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

the field is still useful I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, override fun onCleared can be deleted. The field is used in another line

Copy link
Contributor

Choose a reason for hiding this comment

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

ah I see this directory viewmodel is also using it to dedupe the requests

if (currentJob == null) {
 // load more
}

Copy link
Member

Choose a reason for hiding this comment

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

@bmarty bmarty merged commit fa256cc into develop Dec 1, 2021
@bmarty bmarty deleted the feature/aris/remove_not_needed_job_cancel_4602 branch December 1, 2021 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants