| ... | ... | @@ -19,7 +19,7 @@ import { |
| 19 | 19 | |
| 20 | 20 | import { usePrimarySettings, useUpdatePrimarySettings } from "../../hooks/useSettings"; |
| 21 | 21 | import { cn } from "../../lib/utils"; |
| 22 | | import { usePrimaryEnvironment } from "../../state/environments"; |
| 22 | import { useEnvironments, usePrimaryEnvironment } from "../../state/environments"; |
| 23 | 23 | import { useEnvironmentQuery } from "../../state/query"; |
| 24 | 24 | import { sourceControlEnvironment } from "../../state/sourceControl"; |
| 25 | 25 | import { Badge } from "../ui/badge"; |
| ... | ... | @@ -508,7 +508,15 @@ function EmptySourceControlDiscovery({ |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | export function SourceControlSettingsPanel() { |
| 511 | | const environmentId = usePrimaryEnvironment()?.environmentId ?? null; |
| 511 | const { environments } = useEnvironments(); |
| 512 | const primaryEnvironment = usePrimaryEnvironment(); |
| 513 | const fallbackEnvironment = |
| 514 | environments.find((environment) => environment.connection.phase === "connected") ?? |
| 515 | environments[0] ?? |
| 516 | null; |
| 517 | const environmentId = |
| 518 | primaryEnvironment?.environmentId ?? fallbackEnvironment?.environmentId ?? null; |
| 519 | const isPrimaryEnvironment = environmentId === primaryEnvironment?.environmentId; |
| 512 | 520 | const discovery = useEnvironmentQuery( |
| 513 | 521 | environmentId === null |
| 514 | 522 | ? null |
| ... | ... | @@ -561,7 +569,9 @@ export function SourceControlSettingsPanel() { |
| 561 | 569 | > |
| 562 | 570 | {result.versionControlSystems.map((item) => ( |
| 563 | 571 | <DiscoveryItemRow key={`vcs:${item.kind}`} item={item}> |
| 564 | | {item.kind === "git" ? <GitFetchIntervalSettings /> : undefined} |
| 572 | {item.kind === "git" && isPrimaryEnvironment ? ( |
| 573 | <GitFetchIntervalSettings /> |
| 574 | ) : undefined} |
| 565 | 575 | </DiscoveryItemRow> |
| 566 | 576 | ))} |
| 567 | 577 | </SettingsSection> |
| ... | ... | @@ -587,7 +597,7 @@ export function SourceControlSettingsPanel() { |
| 587 | 597 | /> |
| 588 | 598 | )} |
| 589 | 599 | |
| 590 | | {environmentId !== null ? <SourceControlWritingSettingsSection /> : null} |
| 600 | {isPrimaryEnvironment ? <SourceControlWritingSettingsSection /> : null} |
| 591 | 601 | </SettingsPageContainer> |
| 592 | 602 | ); |
| 593 | 603 | } |