fix: Improve media_query retry behavior (#2603)

This commit is contained in:
Dermot Duffy
2026-07-23 22:19:17 -07:00
committed by GitHub
parent 6817d27c91
commit 54f75beb9d
10 changed files with 302 additions and 16 deletions
+6
View File
@@ -50,6 +50,12 @@ export interface ViewFactoryOptions {
// user-facing locks (e.g. an active call ending).
force?: boolean;
// Why this view change is being made. 'retry' marks a re-run of a previously
// failed query and, unlike a navigation, does not clear the existing error(s)
// up front: it persists until this attempt resolves. Defaults to
// 'navigation'.
intent?: 'navigation' | 'retry';
// Options for the query executor that control how a query is executed and the
// result selected.
queryExecutorOptions?: QueryExecutorOptions;
+9 -4
View File
@@ -218,10 +218,6 @@ export class ViewManager implements ViewManagerInterface {
},
});
this._api.getIssueManager().reset('view_incompatible');
// A new query is about to run, so any stale media_query error from a
// previous attempt is no longer meaningful. If this new query also
// fails, it will re-trigger below.
this._api.getIssueManager().reset('media_query');
} catch (e) {
if (!this._view) {
initialView = this._getFailSafeView(viewFactoryFunc);
@@ -233,6 +229,15 @@ export class ViewManager implements ViewManagerInterface {
return;
}
// A new query is about to run and is allowed to commit, so any stale
// media_query error from a previous attempt is no longer meaningful (on
// failure it re-triggers below). A retry is the exception: it re-runs the
// same failing query, so its error must persist until this attempt resolves
// rather than being cleared here and re-appearing on the next failure.
if (options?.intent !== 'retry') {
this._api.getIssueManager().reset('media_query');
}
if (this._view && this._shouldAdoptQueryAndResults(initialView)) {
initialView.query = this._view.query;
initialView.queryResults = this._view.queryResults;