fix:cross‑region realtime for deployment logs (NYC); align with Functions pattern

This commit is contained in:
Harsh Mahajan
2025-08-08 13:03:20 +05:30
parent a016214c4f
commit daca6819e1
2 changed files with 18 additions and 12 deletions
@@ -7,7 +7,7 @@
import Aside from '../aside.svelte';
import Logs from '../../(components)/logs.svelte';
import { Copy, SvgIcon } from '$lib/components';
import { sdk } from '$lib/stores/sdk';
import { realtime } from '$lib/stores/sdk';
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import { getFrameworkIcon } from '$lib/stores/sites';
@@ -18,9 +18,9 @@
let deployment = $state(data.deployment);
onMount(() => {
return sdk.forConsole.client.subscribe(
'console',
async (response: RealtimeResponseEvent<Models.Deployment>) => {
const unsubscribe = realtime
.forProject(page.params.region, page.params.project)
.subscribe('console', async (response: RealtimeResponseEvent<Models.Deployment>) => {
if (
response.events.includes(
`sites.${data.site.$id}.deployments.${data.deployment.$id}.update`
@@ -33,8 +33,11 @@
);
}
}
}
);
});
return () => {
unsubscribe();
};
});
</script>
@@ -1,6 +1,6 @@
<script lang="ts">
import { Container } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import { realtime } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import type { Models, RealtimeResponseEvent } from '@appwrite.io/console';
import SiteCard from '../../../(components)/siteCard.svelte';
@@ -30,9 +30,9 @@
let showCancel = $state(false);
onMount(() => {
return sdk.forConsole.client.subscribe(
'console',
async (response: RealtimeResponseEvent<Models.Deployment>) => {
const unsubscribe = realtime
.forProject(page.params.region, page.params.project)
.subscribe('console', async (response: RealtimeResponseEvent<Models.Deployment>) => {
if (
response.events.includes(
`sites.${page.params.site}.deployments.${page.params.deployment}.update`
@@ -40,8 +40,11 @@
) {
await invalidate(Dependencies.DEPLOYMENT);
}
}
);
});
return () => {
unsubscribe();
};
});
</script>