mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: use region-scoped console realtime for deployments; no manual reloads
This commit is contained in:
1 parent
daca6819e1
commit
71eea341f6
2 files changed
+32
-34
No files matched your search
+18
-19
@@ -7,7 +7,7 @@
|
||||
import Aside from '../aside.svelte';
|
||||
import Logs from '../../(components)/logs.svelte';
|
||||
import { Copy, SvgIcon } from '$lib/components';
|
||||
import { realtime } from '$lib/stores/sdk';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
import { getFrameworkIcon } from '$lib/stores/sites';
|
||||
@@ -18,26 +18,25 @@
|
||||
let deployment = $state(data.deployment);
|
||||
|
||||
onMount(() => {
|
||||
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`
|
||||
)
|
||||
) {
|
||||
deployment = response.payload;
|
||||
if (response.payload.status === 'ready') {
|
||||
goto(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/sites/create-site/finish?site=${data.site.$id}`
|
||||
);
|
||||
return sdk
|
||||
.forConsoleIn(page.params.region)
|
||||
.client.subscribe(
|
||||
'console',
|
||||
async (response: RealtimeResponseEvent<Models.Deployment>) => {
|
||||
if (
|
||||
response.events.includes(
|
||||
`sites.${data.site.$id}.deployments.${data.deployment.$id}.update`
|
||||
)
|
||||
) {
|
||||
deployment = response.payload;
|
||||
if (response.payload.status === 'ready') {
|
||||
goto(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/sites/create-site/finish?site=${data.site.$id}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
};
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
+14
-15
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Container } from '$lib/layout';
|
||||
import { realtime } from '$lib/stores/sdk';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
import type { Models, RealtimeResponseEvent } from '@appwrite.io/console';
|
||||
import SiteCard from '../../../(components)/siteCard.svelte';
|
||||
@@ -30,21 +30,20 @@
|
||||
let showCancel = $state(false);
|
||||
|
||||
onMount(() => {
|
||||
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`
|
||||
)
|
||||
) {
|
||||
await invalidate(Dependencies.DEPLOYMENT);
|
||||
return sdk
|
||||
.forConsoleIn(page.params.region)
|
||||
.client.subscribe(
|
||||
'console',
|
||||
async (response: RealtimeResponseEvent<Models.Deployment>) => {
|
||||
if (
|
||||
response.events.includes(
|
||||
`sites.${page.params.site}.deployments.${page.params.deployment}.update`
|
||||
)
|
||||
) {
|
||||
await invalidate(Dependencies.DEPLOYMENT);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
};
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in new issue
Block a user