fix(app): keep a search selection one-shot and always reach Summary
A retired or unknown field hit now selects the plain Summary instead of leaving an open visit pane in place, matching the browser's searchFieldTab and Android. The resolved target is a sealed Summary/visit value, so the field mapping lives in one place. An unapplied request is dropped when the shell leaves the run it names, so Backing out of a loading detail no longer replays the selection on a later, unrelated visit. Search/Templates/Schedules pages above the run keep it.
This commit is contained in:
@@ -97,6 +97,15 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
||||
/// The saved-schedule list page, opened above Settings.
|
||||
bool get schedulesOpen => _route.kind == AppRouteKind.schedules;
|
||||
|
||||
/// The route the shell renders underneath the transient Search, Templates
|
||||
/// and Schedules pages. Those pages keep the shell mounted, so the route the
|
||||
/// operator last opened there is still the shell's own destination.
|
||||
AppRoute get shellRoute => searchOpen
|
||||
? _searchReturn
|
||||
: templatesOpen || schedulesOpen
|
||||
? _templatesReturn
|
||||
: _route;
|
||||
|
||||
@override
|
||||
AppRoute get currentConfiguration => _route;
|
||||
|
||||
|
||||
@@ -69,7 +69,8 @@ class _PipelinesAppState extends State<PipelinesApp> {
|
||||
/// One run detail request from Search, delivered through the shell so the
|
||||
/// mounted run detail can resolve it once the named run's steps have loaded.
|
||||
/// A field or artifact hit names no addressable URL of its own, so the request
|
||||
/// is not route state; it is consumed and cleared after it is applied.
|
||||
/// is not route state; it is cleared after the detail applies it or when the
|
||||
/// shell leaves that run, so an abandoned hit never replays later.
|
||||
RunSearchSelection? _pendingRunSearch;
|
||||
|
||||
/// One notification capability for the app: the Runs attention surface
|
||||
@@ -113,6 +114,7 @@ class _PipelinesAppState extends State<PipelinesApp> {
|
||||
schedulesBuilder: _buildSchedules,
|
||||
builder: _buildShell,
|
||||
);
|
||||
_delegate.addListener(_routeChanged);
|
||||
_config = RouterConfig<AppRoute>(
|
||||
routeInformationParser: const AppRouteParser(),
|
||||
routerDelegate: _delegate,
|
||||
@@ -124,6 +126,7 @@ class _PipelinesAppState extends State<PipelinesApp> {
|
||||
@override
|
||||
void dispose() {
|
||||
_notifications.dispose();
|
||||
_delegate.removeListener(_routeChanged);
|
||||
_delegate.dispose();
|
||||
if (_ownsProvider) {
|
||||
(_provider as PlatformRouteInformationProvider).dispose();
|
||||
@@ -198,6 +201,21 @@ class _PipelinesAppState extends State<PipelinesApp> {
|
||||
setState(() => _pendingRunSearch = null);
|
||||
}
|
||||
|
||||
/// Drops a pending request once the shell leaves the run it names.
|
||||
///
|
||||
/// The mounted detail is the only consumer, and it exists only after the run's
|
||||
/// detail has loaded. Backing out while that read is still pending, or leaving
|
||||
/// a failed detail, would otherwise keep the request for the next unrelated
|
||||
/// visit to the same run. Search/Templates/Schedules pages above the run keep
|
||||
/// it, because the shell route underneath them still names that run.
|
||||
void _routeChanged() {
|
||||
final pending = _pendingRunSearch;
|
||||
if (!mounted || pending == null) return;
|
||||
final route = _delegate.shellRoute;
|
||||
if (route.kind == AppRouteKind.runs && route.runId == pending.runId) return;
|
||||
setState(() => _pendingRunSearch = null);
|
||||
}
|
||||
|
||||
/// The Templates page above Settings. Closing it restores the same Settings
|
||||
/// screen instance, so an edited field or an open connection state survives.
|
||||
Widget _buildSchedules(BuildContext context) => SchedulesDestination(
|
||||
|
||||
Reference in New Issue
Block a user