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

Replace tasks list providers with id-based providing #2046

Merged
merged 13 commits into from
Aug 13, 2024

Conversation

bitfriend
Copy link
Contributor

@bitfriend bitfriend commented Aug 7, 2024

  • Remove ref.invalidate() about parts that were added after 1st version of subscribeStream replacing
  • Exclude dot file of flutter plugins from git

@bitfriend
Copy link
Contributor Author

The following could fix issue that outer list page of tasklists is not updated when tasklist title changes:

  1. Pass taskListId not taskList to TaskListItemCard, so that renderer can detect the clearer change condition
  2. Convert taskListId into taskList using ref.watch(taskListItemProvider(taskListId)).when() in TaskListItemCard

Then TaskListItemCard in outer list page is automatically re-rendered whenever tasklist title changes.

@bitfriend bitfriend marked this pull request as ready for review August 12, 2024 13:59
Copy link
Contributor

@kumarpalsinh25 kumarpalsinh25 left a comment

Choose a reason for hiding this comment

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

Code wise look good to me. At some of place not sure about ref.invalidate removal so would request @gnunicorn to review once before it gets merged.

Copy link
Contributor

@gnunicorn gnunicorn left a comment

Choose a reason for hiding this comment

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

It's fine but the title of the PR doesn't describe this ...

Comment on lines 63 to 65
return const ListTile(
title: Text('failed'),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

we should show the error for easier debugging

Suggested change
return const ListTile(
title: Text('failed'),
);
return ListTile(
title: Text('Loading failed: $error'),
);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed by 0308002

@@ -193,13 +212,11 @@ class TaskItem extends ConsumerWidget {
);
}

Key doneKey() {
final taskId = task.eventIdStr();
Key doneKey(String taskId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

these are not necessary. taskId is an attribute of the widget, we don't have to pass it in.

Suggested change
Key doneKey(String taskId) {
Key doneKey() {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed by 633f3a7

return Key('task-entry-$taskId-status-btn-done');
}

Key notDoneKey() {
final taskId = task.eventIdStr();
Key notDoneKey(String taskId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Key notDoneKey(String taskId) {
Key notDoneKey() {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed by 633f3a7

Comment on lines 50 to 53
_log.severe('failed to load tasklist', error, stack);
return const Card(
child: Text('failed'),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed by 0308002

Comment on lines 61 to 62
Widget title(BuildContext context, TaskList taskList) {
final taskListId = taskList.eventIdStr();
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary, we already know taskListId.

Suggested change
Widget title(BuildContext context, TaskList taskList) {
final taskListId = taskList.eventIdStr();
Widget title(BuildContext context, TaskList taskList) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed by 633f3a7

@gnunicorn gnunicorn changed the title [missing] Replace ref.invalidate with subscribeStream Replace tasks list providers with id-based providing Aug 13, 2024
@bitfriend bitfriend merged commit e479f21 into acterglobal:main Aug 13, 2024
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants