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

After tapping 'Retry' button, loading screen does not reappear #147

Open
rhinck opened this issue Jan 23, 2024 · 1 comment
Open

After tapping 'Retry' button, loading screen does not reappear #147

rhinck opened this issue Jan 23, 2024 · 1 comment

Comments

@rhinck
Copy link

rhinck commented Jan 23, 2024

onRetry: () => ref.invalidate(appStartupProvider),

With the current code, when I tap the Retry button, no UI change occurs when the provider is invalidated (the UI stays on the error screen and does not show the loading widget).

Is this the intended behavior?


I made a modifications to make the loading state always appear when refreshing from an error, are there any potential downsides you see to this modification?

@Riverpod(keepAlive: true)
Future<void> appStartup(AppStartupRef ref) async {
  ref.onDispose(() {
    // ensure dependent providers are disposed as well
  });

  // (NEW) Set the initial state to loading
  ref.state = const AsyncValue.loading();

  await Future.wait([
    Future.delayed(const Duration(seconds: 5), () {
      throw Exception('Error after 5 seconds');
    }),
	// list of providers to be warmed up
  ]);
}
@frankdavid-addae
Copy link

I am also having the same issue. Nothing happens when the Retry button is tapped when an error occurs.
How can we rectify this issue?

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

No branches or pull requests

2 participants