Skip to content

Commit 52442fe

Browse files
committed
fix: refresh content on reconnect
1 parent 2248387 commit 52442fe

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

packages/app-frontend/src/features/App.vue

+12-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default defineComponent({
3737
},
3838
3939
setup() {
40-
const { isConnected, isInitializing, showDisplayDisconnected } = useAppConnection()
40+
const { isConnected, isInitializing, showDisplayDisconnected, connectedTimes } = useAppConnection()
4141
4242
function updateTheme(theme: string) {
4343
if (theme === 'dark' || theme === 'high-contrast' || (theme === 'auto' && chromeTheme === 'dark')) {
@@ -81,6 +81,7 @@ export default defineComponent({
8181
isConnected,
8282
isInitializing,
8383
showDisplayDisconnected,
84+
connectedTimes,
8485
showAppsSelector,
8586
orientation,
8687
isChrome,
@@ -91,10 +92,9 @@ export default defineComponent({
9192

9293
<template>
9394
<div
94-
class="app w-full h-full flex relative outline-none"
95+
class="app w-full h-full relative outline-none"
9596
:class="{
9697
'disconnected pointer-events-none': !isInitializing && !isConnected,
97-
'flex-col': orientation === 'portrait',
9898
}"
9999
tabindex="0"
100100
>
@@ -108,7 +108,14 @@ export default defineComponent({
108108
class="absolute inset-0"
109109
/>
110110

111-
<template v-else>
111+
<div
112+
v-else
113+
:key="connectedTimes"
114+
class="w-full h-full flex"
115+
:class="{
116+
'flex-col': orientation === 'portrait',
117+
}"
118+
>
112119
<AppHeader class="flex-none relative z-10 border-b border-gray-200 dark:border-gray-700" />
113120

114121
<SplitPane
@@ -129,7 +136,7 @@ export default defineComponent({
129136
<router-view class="h-full overflow-auto" />
130137
</template>
131138
</SplitPane>
132-
</template>
139+
</div>
133140

134141
<TeleportTarget id="root" />
135142

packages/app-frontend/src/features/connection/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useNow } from '@vueuse/core'
44
const isConnected = ref(false)
55
const isInitializing = ref(true)
66
const lastDisconnect = ref(0)
7+
const connectedTimes = ref(0)
78

89
export function useAppConnection() {
910
const now = useNow({
@@ -25,6 +26,7 @@ export function useAppConnection() {
2526
isInitializing,
2627
lastDisconnect,
2728
showDisplayDisconnected,
29+
connectedTimes,
2830
}
2931
}
3032

@@ -36,6 +38,9 @@ export function setAppConnected(value: boolean, force = false) {
3638
lastDisconnect.value = Date.now()
3739
}
3840
isConnected.value = value
41+
if (value) {
42+
connectedTimes.value++
43+
}
3944
}
4045

4146
export function setAppInitializing(value: boolean) {

0 commit comments

Comments
 (0)