Skip to content

Commit d884dba

Browse files
committed
fix(web): providers ignore a retained project so it cannot block the page
Signed-off-by: Yordis Prieto <[email protected]>
1 parent 1eeb4a6 commit d884dba

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎apps/web/src/components/settings/SettingsScopeSentence.tsx‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ export function SettingsScopeSentence() {
7171
return (
7272
<p className="flex min-w-0 items-center gap-1.5 px-3 text-base text-muted-foreground sm:px-4">
7373
<span className="shrink-0">Applying settings on</span>
74-
<EnvironmentScopeMenu
75-
{...props}
76-
onChange={(next) => scope.selectScope(next.machine ? { machine: next.machine } : {})}
77-
/>
74+
<EnvironmentScopeMenu {...props} />
7875
</p>
7976
);
8077
}

‎apps/web/src/routes/settings.providers.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { useSettingsScope } from "../components/settings/SettingsScopeContext";
66

77
/**
88
* Providers are machine state, so the page shows one environment at a time:
9-
* the chosen one from the settings scope selector.
10-
* A project crumb narrows candidates to where that project is registered.
9+
* the chosen one from the settings scope selector. The project is ignored.
1110
*/
1211
function SettingsProvidersRoute() {
1312
const target = Route.useSearch();

‎apps/web/src/routes/settings.tsx‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Outlet, createFileRoute, redirect, useLocation } from "@tanstack/react-router";
2-
import { useState, type ReactNode } from "react";
2+
import { useMemo, useState, type ReactNode } from "react";
33
import { RotateCcwIcon } from "lucide-react";
44
import { Button } from "../components/ui/button";
55
import { useSettingsRestore } from "../components/settings/SettingsPanels";
@@ -16,7 +16,10 @@ import {
1616
} from "../components/settings/SettingsScopeContext";
1717
import { useEnvironments } from "../state/environments";
1818
import { SettingsScopeNotice } from "../components/settings/SettingsScopeNotice";
19-
import { SETTINGS_DEVICE_ONLY_PATHS } from "../components/settings/SettingsScopeSentence";
19+
import {
20+
SETTINGS_DEVICE_ONLY_PATHS,
21+
SETTINGS_ENVIRONMENT_ONLY_PATHS,
22+
} from "../components/settings/SettingsScopeSentence";
2023
import { SettingsPageContainer } from "../components/settings/settingsLayout";
2124
import {
2225
retainSettingsScope,
@@ -151,9 +154,14 @@ function SettingsRouteLayout() {
151154
const rawSearch = Route.useSearch();
152155
const navigate = Route.useNavigate();
153156
const pathname = useLocation({ select: (location) => location.pathname });
157+
const environmentOnly = SETTINGS_ENVIRONMENT_ONLY_PATHS.has(pathname);
158+
const search = useMemo(
159+
() => (environmentOnly ? (rawSearch.machine ? { machine: rawSearch.machine } : {}) : rawSearch),
160+
[environmentOnly, rawSearch],
161+
);
154162
return (
155163
<SettingsScopeProvider
156-
search={rawSearch}
164+
search={search}
157165
singleEnvironment={pathname === "/settings/providers"}
158166
onChange={(next) => {
159167
// Send every axis so the retain middleware sees an explicit target

0 commit comments

Comments
 (0)