Skip to content

Commit

Permalink
Add non-blocking provider preloader
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo committed Sep 18, 2024
1 parent a123a51 commit 90bcf0e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 36 deletions.
11 changes: 7 additions & 4 deletions frontend/lib/ui/artefact_page/artefact_page_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import 'package:intersperse/intersperse.dart';
import 'package:yaru/yaru.dart';
import '../../models/artefact.dart';
import '../../models/test_execution.dart';
import '../../providers/environments_issues.dart';
import '../../providers/filtered_test_executions.dart';
import '../../providers/tests_issues.dart';
import '../../routing.dart';
import '../non_blocking_provider_preloader.dart';
import '../spacing.dart';
import 'environment_issues/environment_issues_preloader.dart';
import 'rerun_filtered_environments_button.dart';
import 'test_execution_expandable/test_execution_expandable.dart';
import 'test_issues/test_issues_preloader.dart';

class ArtefactPageBody extends ConsumerWidget {
const ArtefactPageBody({super.key, required this.artefact});
Expand Down Expand Up @@ -44,8 +45,10 @@ class ArtefactPageBody extends ConsumerWidget {
const RerunFilteredEnvironmentsButton(),
],
),
EnvironmentIssuesPreloader(
child: TestIssuesPreloader(
NonBlockingProviderPreloader(
provider: environmentsIssuesProvider,
child: NonBlockingProviderPreloader(
provider: testsIssuesProvider,
child: Expanded(
child: ListView.builder(
itemCount: testExecutions.length,
Expand Down

This file was deleted.

This file was deleted.

19 changes: 19 additions & 0 deletions frontend/lib/ui/non_blocking_provider_preloader.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class NonBlockingProviderPreloader extends ConsumerWidget {
const NonBlockingProviderPreloader({
super.key,
required this.provider,
required this.child,
});

final ProviderListenable provider;
final Widget child;

@override
Widget build(BuildContext context, WidgetRef ref) {
ref.watch(provider);
return child;
}
}

0 comments on commit 90bcf0e

Please sign in to comment.