Skip to content

Commit

Permalink
fix: improve pull to refresh on wallet page (#689)
Browse files Browse the repository at this point in the history
## Description
<!-- Briefly explain the purpose of this PR and what it accomplishes.
-->

## Additional Notes
<!-- Add any extra context or relevant information here. -->

## Type of Change
- [x] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Refactoring
- [ ] Documentation
- [ ] Chore

## Screenshots (if applicable)


https://github.com/user-attachments/assets/fd71df4a-5cb1-4e14-9fd9-9be89a7b30df
  • Loading branch information
ice-ajax authored Feb 12, 2025
1 parent d998b74 commit 5eac5a4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
13 changes: 12 additions & 1 deletion lib/app/features/user/providers/follow_list_provider.c.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ Future<FollowListEntity?> followList(
bool network = true,
bool cache = true,
}) async {
ref.onDispose(
() => ref.invalidate(
ionConnectEntityProvider(
eventReference: ReplaceableEventReference(pubkey: pubkey, kind: FollowListEntity.kind),
network: network,
cache: cache,
),
),
);

return await ref.watch(
ionConnectEntityProvider(
eventReference: ReplaceableEventReference(pubkey: pubkey, kind: FollowListEntity.kind),
Expand All @@ -34,7 +44,8 @@ Future<FollowListEntity?> currentUserFollowList(Ref ref) async {
if (currentPubkey == null) {
return null;
}
return ref.watch(followListProvider(currentPubkey).future);
ref.onDispose(() => ref.invalidate(followListProvider(currentPubkey, cache: false)));
return ref.watch(followListProvider(currentPubkey, cache: false).future);
}

@riverpod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ class Balance extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
final currentWalletData = ref.watch(currentWalletViewDataProvider).valueOrNull;
final walletBalance = currentWalletData?.usdBalance ?? 0;
final isLoading = currentWalletData == null;
final currentWalletData = ref.watch(currentWalletViewDataProvider);
final currentWallet = currentWalletData.valueOrNull;
final walletBalance = currentWallet?.usdBalance ?? 0;
final isLoading = currentWalletData.isLoading;

final isBalanceVisible = ref.watch(isBalanceVisibleSelectorProvider);
final hitSlop = 5.0.s;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:ion/app/features/wallets/providers/filtered_assets_provider.c.da
import 'package:ion/app/features/wallets/views/components/coins_list/coin_item.dart';
import 'package:ion/app/features/wallets/views/pages/wallet_page/components/coins/coins_tab_footer.dart';
import 'package:ion/app/features/wallets/views/pages/wallet_page/components/empty_state/empty_state.dart';
import 'package:ion/app/features/wallets/views/pages/wallet_page/components/loaders/list_loader.dart';
import 'package:ion/app/features/wallets/views/pages/wallet_page/tab_type.dart';
import 'package:ion/app/router/app_routes.c.dart';

Expand Down Expand Up @@ -50,6 +51,7 @@ class CoinsTab extends ConsumerWidget {
],
);
},
loading: () => const ListLoader(),
orElse: () => const SliverToBoxAdapter(
child: SizedBox.shrink(),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ContactsList extends ConsumerWidget {
);

return friendsDataState.maybeWhen(
skipLoadingOnRefresh: false,
data: (friends) {
final friendsPubkeys = friends?.pubkeys ?? [];

Expand Down

0 comments on commit 5eac5a4

Please sign in to comment.