authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-30 16:20:06-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-30 16:20:06-07:00
log7c67876983ade7ef886c825eefe569b3a96c81e8
tree26253bad8bb64103efa51db1e3d1b4480cc56075
parentbd89c1302026255c62cc09278207bfaf2664da4a
signature Signed by PGP key B5690EEEBB952194

fix(clients): hide disconnected environments when adding projects (#14490)


2 files changed, 21 insertions(+), 16 deletions(-)

apps/mobile/src/features/projects/AddProjectScreen.tsx+4-1
...@@ -405,7 +405,10 @@ function useEnvironmentOptions(): ReadonlyArray<EnvironmentOption> {...@@ -405,7 +405,10 @@ function useEnvironmentOptions(): ReadonlyArray<EnvironmentOption> {
405 supportsCloneTracking: config?.environment.capabilities.projectCloneTracking === true,405 supportsCloneTracking: config?.environment.capabilities.projectCloneTracking === true,
406 };406 };
407 });407 });
408 return Arr.sort(options, environmentOptionOrder);408 return Arr.sort(
409 options.filter((environment) => canCreateProjectInEnvironment(environment.connectionState)),
410 environmentOptionOrder,
411 );
409 }, [connectedEnvironments, savedConnectionsById, serverConfigByEnvironmentId]);412 }, [connectedEnvironments, savedConnectionsById, serverConfigByEnvironmentId]);
410}413}
411414
apps/web/src/components/CommandPalette.tsx+17-15
...@@ -963,21 +963,23 @@ function OpenCommandPaletteDialog(props: {...@@ -963,21 +963,23 @@ function OpenCommandPaletteDialog(props: {
963 );963 );
964964
965 const addProjectEnvironmentOptions = useMemo(() => {965 const addProjectEnvironmentOptions = useMemo(() => {
966 const options = environments.map((environment): AddProjectEnvironmentOption => {966 const options = environments
967 const isPrimary = environment.entry.target._tag === "PrimaryConnectionTarget";967 .filter((environment) => canCreateProjectInEnvironment(environment.connection.phase))
968 return {968 .map((environment): AddProjectEnvironmentOption => {
969 environmentId: environment.environmentId,969 const isPrimary = environment.entry.target._tag === "PrimaryConnectionTarget";
970 label: resolveEnvironmentOptionLabel({970 return {
971 isPrimary,
972 environmentId: environment.environmentId,971 environmentId: environment.environmentId,
973 runtimeLabel: environment.label,972 label: resolveEnvironmentOptionLabel({
974 }),973 isPrimary,
975 isPrimary,974 environmentId: environment.environmentId,
976 machine: resolveEnvironmentMachineKind(environment.serverConfig),975 runtimeLabel: environment.label,
977 isConnected: canCreateProjectInEnvironment(environment.connection.phase),976 }),
978 status: connectionStatusText(environment.connection),977 isPrimary,
979 };978 machine: resolveEnvironmentMachineKind(environment.serverConfig),
980 });979 isConnected: canCreateProjectInEnvironment(environment.connection.phase),
980 status: connectionStatusText(environment.connection),
981 };
982 });
981983
982 options.sort((left, right) => {984 options.sort((left, right) => {
983 if (left.isPrimary !== right.isPrimary) {985 if (left.isPrimary !== right.isPrimary) {
...@@ -1658,7 +1660,7 @@ function OpenCommandPaletteDialog(props: {...@@ -1658,7 +1660,7 @@ function OpenCommandPaletteDialog(props: {
1658 );1660 );
16591661
1660 const openAddProjectFlow = useCallback(() => {1662 const openAddProjectFlow = useCallback(() => {
1661 // With no environment at all there is nothing to browse, so the only1663 // With no connected environment there is nothing to browse, so the only
1662 // useful next step is connecting one.1664 // useful next step is connecting one.
1663 if (addProjectEnvironmentOptions.length === 0) {1665 if (addProjectEnvironmentOptions.length === 0) {
1664 setOpen(false);1666 setOpen(false);