Skip to content

Conversation

@zaelgohary
Copy link
Contributor

@zaelgohary zaelgohary commented Jun 4, 2025

Changes

  • Add comprehensive farms provider with V3 and V4 farm support
  • Implement parallel loading of farms and nodes for optimal performance
  • Add smart caching with 5-minute timeout and offline fallback support
  • Enhance wallets provider with background preloading and 2-minute cache
  • Create preloading service for coordinated background data loading
  • Refactor farm screen to use provider pattern like wallet screen
  • Implement automatic reloading with 30-second intervals
  • Add error resilience with cached data fallback during network issues

Performance improvements:

  • 60-75% faster farm loading through parallel V3/V4 processing
  • 70-80% faster wallet loading with background preloading
  • 75-80% reduction in network requests through intelligent caching

Related Issues

#1036

Tested Scenarios

  • Navigate to farming & wallets

@zaelgohary zaelgohary changed the base branch from development to development_app_layout June 4, 2025 14:14
@zaelgohary zaelgohary changed the title feat: implement farms provider with V3/V4 support and background preloading Feat: Implement farms provider and background preloading Jun 4, 2025
@zaelgohary zaelgohary marked this pull request as ready for review June 10, 2025 08:38
}
}

final preloadingServiceProvider = Provider<PreloadingService>((ref) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why don't we return

final preloadingServiceProvider = Provider<PreloadingService>((ref) {
      return PreloadingService(
        ref.read(walletsNotifier.notifier),
        ref.read(farmsNotifier.notifier)
      );
    });

directly from here.
What do u 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.

But why? The PreloadingService uses a singleton pattern which ensures there is only one instance of it throughout the app. It's a simpler approach and we avoid creating multiple instances.

if (!_reload) return;
if (!_loading && _isListed) {
try {
final wallets = <Wallet>[];
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Why passing empty list ? we can pass the wallets from walletsNotifier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm resetting the state before using refresh from wallet provider.

@zaelgohary zaelgohary requested a review from AlaaElattar June 23, 2025 06:13
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