Conversation
…n necessary Reactive task errors now only take over the splash screen when they actually block bootstrap: - initial reactive run failure (no previous value), or - trigger-caused reactive refresh failure. Non-trigger runtime reactive failures after successful bootstrap no longer replace app content with splash error UI. Add shouldDisplayReactiveTaskError helper function and tests for reactive error visibility rules.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the user experience during application startup and runtime by making reactive error handling more intelligent. It ensures that the splash screen only displays errors when they are critical to the bootstrap process, avoiding disruptive error overlays for less severe, non-blocking reactive failures that occur after the app has successfully loaded. This change leads to a smoother and less intrusive error reporting mechanism for reactive tasks. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively refines the error handling for reactive tasks, ensuring the splash screen only blocks the UI for critical bootstrap failures. The logic is well-encapsulated in the new shouldDisplayReactiveTaskError helper function, and the implementation in SplashBuilder is clean. My main feedback is to enhance the test coverage for the new logic to ensure all scenarios, particularly trigger-caused failures, are explicitly verified.
| test( | ||
| 'runtime reactive error is hidden when previous value exists', | ||
| () { | ||
| final runtimeError = | ||
| const AsyncError<void>( | ||
| 'runtime error', | ||
| StackTrace.empty, | ||
| ) | ||
| // ignore: invalid_use_of_internal_member | ||
| .copyWithPrevious(const AsyncData<void>(null)); | ||
|
|
||
| final shouldShow = shouldDisplayReactiveTaskError( | ||
| reactiveTaskRun: runtimeError, | ||
| triggerCausedRefresh: false, | ||
| ); | ||
|
|
||
| expect(runtimeError.hasError, isTrue); | ||
| expect(runtimeError.hasValue, isTrue); | ||
| expect(shouldShow, isFalse); | ||
| }, | ||
| ); | ||
|
|
||
| test('initial reactive error is shown when no previous value exists', () { | ||
| const initialError = AsyncError<void>( | ||
| 'initial error', | ||
| StackTrace.empty, | ||
| ); | ||
|
|
||
| // Initial load - splash shown, then content | ||
| await tester.pumpAndSettle(); | ||
| expect(find.text('Content'), findsOneWidget); | ||
| expect(runCount, 1); | ||
| final initialSplashCount = splashBuildCount; | ||
|
|
||
| // Now trigger an error WITHOUT changing the trigger | ||
| // This simulates a dependency of run() causing a re-run that errors | ||
| final container = ProviderScope.containerOf( | ||
| tester.element(find.text('Content')), | ||
| final shouldShow = shouldDisplayReactiveTaskError( | ||
| reactiveTaskRun: initialError, | ||
| triggerCausedRefresh: false, | ||
| ); | ||
|
|
||
| // Set error flag and invalidate run provider to simulate re-run | ||
| shouldError = true; | ||
| container.invalidate(reactiveTaskRunProvider); | ||
|
|
||
| // Pump to process the error | ||
| await tester.pump(); | ||
| await tester.pump(); | ||
| await tester.pump(); | ||
|
|
||
| // Error screen should be shown | ||
| expect(errorScreenShown, isTrue); | ||
| expect(find.text('Error - Retry'), findsOneWidget); | ||
|
|
||
| // CRITICAL: Splash should NOT have been shown again | ||
| // (splashBuildCount should not have increased) | ||
| expect( | ||
| splashBuildCount, | ||
| initialSplashCount, | ||
| reason: 'Splash should not show when error occurs without trigger change', | ||
| ); | ||
| expect(initialError.hasError, isTrue); | ||
| expect(initialError.hasValue, isFalse); | ||
| expect(shouldShow, isTrue); | ||
| }); |
There was a problem hiding this comment.
These new unit tests for shouldDisplayReactiveTaskError are great for verifying the new error visibility rules. However, they only cover cases where triggerCausedRefresh is false.
To ensure complete test coverage for the new logic, consider adding a test case for when a trigger-caused refresh fails. This would verify that the error screen is correctly displayed even if there's a previous value, which is a key part of the new behavior.
Here's a suggestion for the new test:
test('trigger-caused reactive error is shown even with a previous value', () {
final triggerError = const AsyncError<void>(
'trigger error',
StackTrace.empty,
)
// ignore: invalid_use_of_internal_member
.copyWithPrevious(const AsyncData<void>(null));
final shouldShow = shouldDisplayReactiveTaskError(
reactiveTaskRun: triggerError,
triggerCausedRefresh: true,
);
expect(triggerError.hasError, isTrue);
expect(triggerError.hasValue, isTrue);
expect(shouldShow, isTrue);
});
Reactive task errors now only take over the splash screen when they actually block bootstrap:
Non-trigger runtime reactive failures after successful bootstrap no longer replace app content with splash error UI. Add shouldDisplayReactiveTaskError helper function and tests for reactive error visibility rules.