Skip to content

Commit c94effb

Browse files
committed
refactor(account): Improve category follow page rebuild
- Rebuild only on relevant state changes
1 parent cf44d4c commit c94effb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/account/view/add_category_to_follow_page.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class AddCategoryToFollowPage extends StatelessWidget {
5656

5757
// Use AccountBloc to check which categories are already followed
5858
return BlocBuilder<AccountBloc, AccountState>(
59+
buildWhen: (previous, current) =>
60+
previous.preferences?.followedCategories != current.preferences?.followedCategories ||
61+
previous.status != current.status, // Rebuild if status changes too
5962
builder: (context, accountState) {
6063
final followedCategories =
6164
accountState.preferences?.followedCategories ?? [];

0 commit comments

Comments
 (0)