|
1 | 1 | import { useAtomValue } from "@effect/atom-react"; |
2 | 2 | import { PROVIDER_DISPLAY_NAMES } from "@t3tools/contracts"; |
3 | 3 | import { Atom } from "effect/reactivity"; |
4 | | -import { useMemo } from "react"; |
5 | 4 |
|
6 | 5 | import { APP_VERSION } from "~/branding"; |
7 | 6 | import { isDesktopLocalConnectionTarget } from "~/connection/desktopLocal"; |
@@ -40,25 +39,21 @@ export type ReportLocalUpdateError = (title: string, description: string) => voi |
40 | 39 | export function useUpdateEverything(localUpdateVersion: string | null) { |
41 | 40 | const targetVersion = localUpdateVersion ?? APP_VERSION; |
42 | 41 | const { environments } = useEnvironments(); |
43 | | - const machinesAtom = useMemo( |
44 | | - () => |
45 | | - Atom.make((get) => |
46 | | - environments.map((environment) => ({ |
47 | | - environmentId: environment.environmentId, |
48 | | - label: environment.label, |
49 | | - serverConfig: environment.serverConfig, |
50 | | - connected: environment.connection.phase === "connected", |
51 | | - hostedByThisApp: |
52 | | - isElectron && |
53 | | - (environment.entry.target._tag === "PrimaryConnectionTarget" || |
54 | | - isDesktopLocalConnectionTarget(environment.entry.target)), |
55 | | - canMaintain: canUpdateServer( |
56 | | - get(environmentSession.sessionStateAtom(environment.environmentId)), |
57 | | - ), |
58 | | - updateState: get(serverEnvironment.updateStateAtom(environment.environmentId)), |
59 | | - })), |
| 42 | + const machinesAtom = Atom.make((get) => |
| 43 | + environments.map((environment) => ({ |
| 44 | + environmentId: environment.environmentId, |
| 45 | + label: environment.label, |
| 46 | + serverConfig: environment.serverConfig, |
| 47 | + connected: environment.connection.phase === "connected", |
| 48 | + hostedByThisApp: |
| 49 | + isElectron && |
| 50 | + (environment.entry.target._tag === "PrimaryConnectionTarget" || |
| 51 | + isDesktopLocalConnectionTarget(environment.entry.target)), |
| 52 | + canMaintain: canUpdateServer( |
| 53 | + get(environmentSession.sessionStateAtom(environment.environmentId)), |
60 | 54 | ), |
61 | | - [environments], |
| 55 | + updateState: get(serverEnvironment.updateStateAtom(environment.environmentId)), |
| 56 | + })), |
62 | 57 | ); |
63 | 58 | const machines = useAtomValue(machinesAtom); |
64 | 59 | const { targets: behindServers, skipped: unreachable } = collectServerUpdateTargets( |
|
0 commit comments