-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update comment count when adding a comment #349
Conversation
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.
Good code with extensive documentation. Left a few remarks, but it should be ready to merge soon.
This allows to rethrow an error that would be thrown inside the async value
I now have an error thrown to the Flutter console when deleting a comment from the user profile page: E/flutter (17447): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: Future already completed
E/flutter (17447): #0 _AsyncCompleter.complete (dart:async/future_impl.dart:43:31)
E/flutter (17447): #1 FutureHandlerProviderElementMixin.onData (package:riverpod/src/async_notifier/base.dart:282:17)
E/flutter (17447): #2 AsyncData.map (package:riverpod/src/common.dart:345:16)
E/flutter (17447): #3 FutureHandlerProviderElementMixin.state= (package:riverpod/src/async_notifier/base.dart:205:14)
E/flutter (17447): #4 AsyncNotifierBase.state= (package:riverpod/src/async_notifier.dart:57:14)
E/flutter (17447): #5 PostCommentCountViewModel.refresh (package:proxima/viewmodels/post_comment_count_view_model.dart:23:5)
E/flutter (17447): <asynchronous suspension> Note: this bug was not present on ef39f27. |
Well, your bug is very strange. It appears the |
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.
Clean code, I just left a small suggestion. I also would like to understand more about this weird bug and its apparent fix.
Apart from that LGTM.
I never encountered that bug and I don't really have time to dig too much into it this week. If you think this should be investigated further, please create a new issue to the project's backlog. |
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.
Thank you for your changes and the isolated testing. LGTM
Co-authored-by: Alberts Reisons <[email protected]>
Fixes #316.
This PR adds a
PostCommentCountViewModel
, which stores a post number of comment (in a similar fashion toPostVotesViewModel
). It is refreshed by doing a fetch to the database when a comment is deleted, and refreshed efficiently when the comment list is refreshed on the post page.This is then tested by taking advantage of the great work @Aderfish made for end-to-end tests.
Happy reviewing! :)
Acceptance criteria: