Skip to content

Commit 23cab0b

Browse files
committed
fix(webapp): gracefully handle RegionsPresenter failure in bulk action loader
Wrap RegionsPresenter.call() with tryCatch so a failure (e.g. missing defaultWorkerInstanceGroupId feature flag on self-hosted) falls back to an empty regions array instead of breaking the entire bulk-action inspector — including the cancel flow which has no dependency on regions.
1 parent a8fb134 commit 23cab0b

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.bulkaction.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,25 @@ export const loader = dashboardLoader(
9191
environmentId: environment.id,
9292
request,
9393
}),
94-
new RegionsPresenter().call({
95-
userId: user.id,
96-
projectSlug: projectParam,
97-
isAdmin: user.admin || user.isImpersonating,
98-
}),
94+
tryCatch(
95+
new RegionsPresenter().call({
96+
userId: user.id,
97+
projectSlug: projectParam,
98+
isAdmin: user.admin || user.isImpersonating,
99+
})
100+
),
99101
]);
100102

103+
const [regionsError, regionsData] = regionsResult;
104+
const regions = regionsError ? [] : regionsData.regions;
105+
101106
// Display flag for the inspector's Cancel/Replay controls — the action
102107
// below enforces write:runs independently.
103108
const { canCreateBulkAction } = checkPermissions(ability, {
104109
canCreateBulkAction: { action: "write", resource: { type: "runs" } },
105110
});
106111

107-
return typedjson({ ...data, regions: regionsResult.regions, canCreateBulkAction });
112+
return typedjson({ ...data, regions, canCreateBulkAction });
108113
}
109114
);
110115

0 commit comments

Comments
 (0)