fix(web): allow removing a relay environment whose server is gone #5494
ClosedTorbenWetter(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/5494/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -309,3 +312,12 @@309312 ),310313 );311314315+ /**316+ * Revokes an environment's link for this account and drops its row. Nothing317+ * is asked of the environment itself, so an environment whose server no318+ * longer exists — wiped host, reinstalled machine — can still be retired;319+ * `t3 connect unlink` only runs where that server still lives. A relay reply320+ * of `ok: false` means the link was already gone, which is the same outcome321+ * the caller wanted, so the row is dropped either way.322+ */323+ const remove = Effect.fn("RelayEnvironmentDiscovery.remove")(function* (
- @@ -311,0 +319,21 @@319+ * `t3 connect unlink` only runs where that server still lives. A relay reply320+ * of `ok: false` means the link was already gone, which is the same outcome321+ * the caller wanted, so the row is dropped either way.322+ */323+ const remove = Effect.fn("RelayEnvironmentDiscovery.remove")(function* (324+ environmentId: RelayClientEnvironmentRecord["environmentId"],325+ ) {326+ const clerkToken = yield* session.clerkToken;327+ yield* relay328+ .unlinkEnvironment({ clerkToken, environmentId })329+ .pipe(Effect.mapError(mapManagedRelayError));330+ yield* clearOfflineReport(environmentId);331+ yield* SubscriptionRef.update(state, (current) => {332+ if (!current.environments.has(environmentId)) {333+ return current;334+ }335+ const environments = new Map(current.environments);336+ environments.delete(environmentId);337+ return { ...current, environments };338+ });339+ });@@ -311,0 +319,21 @@319+ * `t3 connect unlink` only runs where that server still lives. A relay reply320+ * of `ok: false` means the link was already gone, which is the same outcome321+ * the caller wanted, so the row is dropped either way.322+ */323+ const remove = Effect.fn("RelayEnvironmentDiscovery.remove")(function* (324+ environmentId: RelayClientEnvironmentRecord["environmentId"],325+ ) {326+ const clerkToken = yield* session.clerkToken;327+ yield* relay328+ .unlinkEnvironment({ clerkToken, environmentId })329+ .pipe(Effect.mapError(mapManagedRelayError));330+ yield* clearOfflineReport(environmentId);331+ yield* SubscriptionRef.update(state, (current) => {332+ if (!current.environments.has(environmentId)) {333+ return current;334+ }335+ const environments = new Map(current.environments);336+ environments.delete(environmentId);337+ return { ...current, environments };338+ });339+ });
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
964c7982-3690-4a4c-85cd-16a52e87ac0eYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share