File tree Expand file tree Collapse file tree 2 files changed +18
-12
lines changed
src/routes/(console)/project-[region]-[project]/sites
site-[site]/deployments/deployment-[deployment] Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 7
7
import Aside from ' ../aside.svelte' ;
8
8
import Logs from ' ../../(components)/logs.svelte' ;
9
9
import { Copy , SvgIcon } from ' $lib/components' ;
10
- import { sdk } from ' $lib/stores/sdk' ;
10
+ import { realtime } from ' $lib/stores/sdk' ;
11
11
import { goto } from ' $app/navigation' ;
12
12
import { onMount } from ' svelte' ;
13
13
import { getFrameworkIcon } from ' $lib/stores/sites' ;
18
18
let deployment = $state (data .deployment );
19
19
20
20
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 >) => {
24
24
if (
25
25
response .events .includes (
26
26
` sites.${data .site .$id }.deployments.${data .deployment .$id }.update `
33
33
);
34
34
}
35
35
}
36
- }
37
- );
36
+ });
37
+
38
+ return () => {
39
+ unsubscribe ();
40
+ };
38
41
});
39
42
</script >
40
43
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import { Container } from ' $lib/layout' ;
3
- import { sdk } from ' $lib/stores/sdk' ;
3
+ import { realtime } from ' $lib/stores/sdk' ;
4
4
import { onMount } from ' svelte' ;
5
5
import type { Models , RealtimeResponseEvent } from ' @appwrite.io/console' ;
6
6
import SiteCard from ' ../../../(components)/siteCard.svelte' ;
30
30
let showCancel = $state (false );
31
31
32
32
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 >) => {
36
36
if (
37
37
response .events .includes (
38
38
` sites.${page .params .site }.deployments.${page .params .deployment }.update `
39
39
)
40
40
) {
41
41
await invalidate (Dependencies .DEPLOYMENT );
42
42
}
43
- }
44
- );
43
+ });
44
+
45
+ return () => {
46
+ unsubscribe ();
47
+ };
45
48
});
46
49
</script >
47
50
You can’t perform that action at this time.
0 commit comments