Skip to content

Commit a81721d

Browse files
committed
feat: bring back disconnected dialog
1 parent 924791d commit a81721d

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

packages/devtools/client/components/DisconnectIndicator.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
<template>
22
<Teleport to="body">
33
<div
4-
v-if="wsConnectingDebounced" flex="~ col justify-center items-center gap-2"
4+
v-if="wsConnectingDebounced"
5+
flex="~ col justify-center items-center gap-4"
56
fixed bottom-0 left-0 right-0 top-0 z-2147483646 p5 text-lg backdrop-blur-5 n-glass-effect
67
>
7-
<div flex="~" mt--10 items-center justify-center>
8-
<NuxtLogo h-14 />
8+
<div flex="~" items-center justify-center>
9+
<NuxtLogo h-8 />
910
</div>
10-
<div v-if="wsError" flex="~ gap-2" items-center text-rose>
11+
<div border="t base" my2 h-1px w-10 />
12+
<div flex="~ gap-2" items-center text-xl op50>
1113
<NIcon icon="i-carbon-wifi-off" />
12-
WebSocket disconnected
14+
Disconnected from Server
1315
</div>
14-
<div v-else flex="~ gap-2" animate-pulse items-center text-yellow>
16+
<div flex="~ gap-2" animate-pulse items-center text-xl text-orange>
1517
<NIcon icon="i-carbon-circle-dash" animate-spin />
16-
Connecting to the server...
18+
Retrying...
1719
</div>
1820
</div>
1921
</Teleport>

packages/devtools/client/composables/rpc.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ async function connectVite() {
6060
onMessage(data)
6161
})
6262

63-
// TODO:
64-
// hot.on('vite:connect', (data) => {})
65-
// hot.on('vite:disconnect', (data) => {})
63+
wsConnecting.value = true
64+
65+
hot.on('vite:ws:connect', () => {
66+
wsConnecting.value = false
67+
})
68+
hot.on('vite:ws:disconnect', () => {
69+
wsConnecting.value = true
70+
})
6671

6772
return hot
6873
}

packages/devtools/src/runtime/plugins/view/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export async function setupDevToolsClient({
148148
return iframe
149149
}
150150

151-
function waitForClientInjection(retry = 10, timeout = 200) {
151+
function waitForClientInjection(retry = 20, timeout = 300) {
152152
let lastError: any
153153
const test = () => {
154154
try {

0 commit comments

Comments
 (0)