| 1 | import { Atom } from "effect/reactivity"; |
| 2 | |
| 3 | import { environmentCatalog } from "../connection/catalog"; |
| 4 | |
| 5 | export const primaryEnvironmentIdAtom = Atom.make((get) => { |
| 6 | for (const [environmentId, entry] of get(environmentCatalog.catalogValueAtom).entries) { |
| 7 | if (entry.target._tag === "PrimaryConnectionTarget") { |
| 8 | return environmentId; |
| 9 | } |
| 10 | } |
| 11 | return null; |
| 12 | }).pipe(Atom.withLabel("web-primary-environment-id")); |