diff --git a/plugins/love-resources/src/components/ControlExt.svelte b/plugins/love-resources/src/components/ControlExt.svelte
index 103d4c5787..971865015d 100644
--- a/plugins/love-resources/src/components/ControlExt.svelte
+++ b/plugins/love-resources/src/components/ControlExt.svelte
@@ -244,16 +244,12 @@
if (isConnected) {
await disconnect()
}
- } else if (!isConnected) {
- const person = $personByIdStore.get(me)
- if (person === undefined) return
- await connectRoom(0, 0, myInfo, person, myOffice)
}
}
}
}
- $: checkOwnRoomConnection($infos, $myInfo, $myOffice, $isConnected)
+ $: checkOwnRoomConnection($infos, $myInfo, $myOffice, $isCurrentInstanceConnected)
const myInvitesCategory = 'myInvites'
@@ -350,6 +346,18 @@
participantClickHandler(e, participant)
}
}
+
+ onDestroy(() => {
+ removeEventListener('beforeunload', beforeUnloadListener)
+ })
+
+ const beforeUnloadListener = () => {
+ if ($myInfo !== undefined) {
+ leaveRoom($myInfo, $myOffice)
+ }
+ }
+
+ window.addEventListener('beforeunload', beforeUnloadListener)
diff --git a/plugins/love-resources/src/components/RequestPopup.svelte b/plugins/love-resources/src/components/RequestPopup.svelte
index 23ec1958ef..bc8af253af 100644
--- a/plugins/love-resources/src/components/RequestPopup.svelte
+++ b/plugins/love-resources/src/components/RequestPopup.svelte
@@ -36,8 +36,8 @@
const person = $personByIdStore.get(me)
if (person === undefined) return
await connectRoom(0, 0, $myInfo, person, $myOffice)
- await client.update(request, { status: RequestStatus.Approved })
}
+ await client.update(request, { status: RequestStatus.Approved })
}
async function decline (): Promise
{
diff --git a/server-plugins/love-resources/src/index.ts b/server-plugins/love-resources/src/index.ts
index 58ac0e5e02..d86f7a284e 100644
--- a/server-plugins/love-resources/src/index.ts
+++ b/server-plugins/love-resources/src/index.ts
@@ -100,8 +100,7 @@ async function createUserInfo (acc: Ref, control: TriggerControl): Prom
[tx],
'createUserInfo'
)
- await control.apply([ptx])
- return []
+ return [ptx]
}
async function removeUserInfo (acc: Ref, control: TriggerControl): Promise {
diff --git a/server/core/src/server/storage.ts b/server/core/src/server/storage.ts
index 44f04bedd4..42ac97aaf9 100644
--- a/server/core/src/server/storage.ts
+++ b/server/core/src/server/storage.ts
@@ -783,6 +783,10 @@ export class TServerStorage implements ServerStorage {
)
const aresult = await performAsync(applyCtx)
+ if (aresult.length > 0) {
+ await this.apply(applyCtx, aresult)
+ }
+
if (applyTxes.length > 0) {
await this.apply(applyCtx, applyTxes)
}