Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): allow stale environments to be deregistered #9761

ClosedRowan-Paul(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/9761/headopened View on GitHub

Showing 5 changed files with 128 additions and 8 deletions (loading 2).

x
0 of 5 viewed, 5 left
22 additions and 0 deletionsapps/mobile/src/features/cloud/managedRelayState.tsModified
View file
@@ -1,9 +1,15 @@
import { useAtomValue } from "@effect/atom-react";
import {
createManagedRelayQueryManager,
+ deregisterManagedRelayEnvironment,
managedRelaySessionAtom,
readManagedRelaySnapshotState,
} from "@t3tools/client-runtime/relay";
+import {
+ createAtomCommandScheduler,
+ createRuntimeCommand,
+} from "@t3tools/client-runtime/state/runtime";
+import type { EnvironmentId } from "@t3tools/contracts";
import type { RelayClientEnvironmentRecord } from "@t3tools/contracts/relay";
import { AsyncResult, Atom } from "effect/unstable/reactivity";
import { useCallback, useEffect } from "react";
@@ -19,6 +25,22 @@
cloudDebugLog(`query:${event.operation}:${event.stage}:${event.phase}`, { ...event }),
});
​
+const managedRelayMutationScheduler = createAtomCommandScheduler();
+​
+export const deregisterManagedRelayEnvironmentCommand = createRuntimeCommand(
+ managedRelayAtomRuntime,
+ {
+ label: "mobile:managed-relay:deregister-environment",
+ scheduler: managedRelayMutationScheduler,
+ concurrency: {
+ mode: "serial",
+ key: (input: { readonly accountId: string; readonly environmentId: EnvironmentId }) =>