Skip to content

Commit daca681

Browse files
committed
fix:cross‑region realtime for deployment logs (NYC); align with Functions pattern
1 parent a016214 commit daca681

File tree

2 files changed

+18
-12
lines changed
  • src/routes/(console)/project-[region]-[project]/sites

2 files changed

+18
-12
lines changed

src/routes/(console)/project-[region]-[project]/sites/create-site/deploying/+page.svelte

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import Aside from '../aside.svelte';
88
import Logs from '../../(components)/logs.svelte';
99
import { Copy, SvgIcon } from '$lib/components';
10-
import { sdk } from '$lib/stores/sdk';
10+
import { realtime } from '$lib/stores/sdk';
1111
import { goto } from '$app/navigation';
1212
import { onMount } from 'svelte';
1313
import { getFrameworkIcon } from '$lib/stores/sites';
@@ -18,9 +18,9 @@
1818
let deployment = $state(data.deployment);
1919
2020
onMount(() => {
21-
return sdk.forConsole.client.subscribe(
22-
'console',
23-
async (response: RealtimeResponseEvent<Models.Deployment>) => {
21+
const unsubscribe = realtime
22+
.forProject(page.params.region, page.params.project)
23+
.subscribe('console', async (response: RealtimeResponseEvent<Models.Deployment>) => {
2424
if (
2525
response.events.includes(
2626
`sites.${data.site.$id}.deployments.${data.deployment.$id}.update`
@@ -33,8 +33,11 @@
3333
);
3434
}
3535
}
36-
}
37-
);
36+
});
37+
38+
return () => {
39+
unsubscribe();
40+
};
3841
});
3942
</script>
4043

src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/deployment-[deployment]/+page.svelte

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { Container } from '$lib/layout';
3-
import { sdk } from '$lib/stores/sdk';
3+
import { realtime } from '$lib/stores/sdk';
44
import { onMount } from 'svelte';
55
import type { Models, RealtimeResponseEvent } from '@appwrite.io/console';
66
import SiteCard from '../../../(components)/siteCard.svelte';
@@ -30,18 +30,21 @@
3030
let showCancel = $state(false);
3131
3232
onMount(() => {
33-
return sdk.forConsole.client.subscribe(
34-
'console',
35-
async (response: RealtimeResponseEvent<Models.Deployment>) => {
33+
const unsubscribe = realtime
34+
.forProject(page.params.region, page.params.project)
35+
.subscribe('console', async (response: RealtimeResponseEvent<Models.Deployment>) => {
3636
if (
3737
response.events.includes(
3838
`sites.${page.params.site}.deployments.${page.params.deployment}.update`
3939
)
4040
) {
4141
await invalidate(Dependencies.DEPLOYMENT);
4242
}
43-
}
44-
);
43+
});
44+
45+
return () => {
46+
unsubscribe();
47+
};
4548
});
4649
</script>
4750

0 commit comments

Comments
 (0)