fix: error when leaving the room without joining
This commit is contained in:
parent
a473a40807
commit
8476595011
4 changed files with 8 additions and 5 deletions
|
@ -7,7 +7,8 @@
|
|||
"scripts": {
|
||||
"dev": "wxt",
|
||||
"dev:firefox": "wxt -b firefox",
|
||||
"build": "wxt build",
|
||||
"build": "cross-env NODE_ENV=production run-p build:*",
|
||||
"build:chorme": "wxt build -b chorme",
|
||||
"build:firefox": "wxt build -b firefox",
|
||||
"pack": "cross-env NODE_ENV=production run-p pack:*",
|
||||
"pack:chrome": "wxt zip -b chrome",
|
||||
|
|
|
@ -22,8 +22,8 @@ export default defineContentScript({
|
|||
excludeMatches: ['*://localhost/*', '*://127.0.0.1/*'],
|
||||
async main(ctx) {
|
||||
const store = Remesh.store({
|
||||
externs: [IndexDBStorageImpl, BrowserSyncStorageImpl, PeerRoomImpl, ToastImpl],
|
||||
inspectors: __DEV__ ? [RemeshLogger()] : []
|
||||
externs: [IndexDBStorageImpl, BrowserSyncStorageImpl, PeerRoomImpl, ToastImpl]
|
||||
// inspectors: __DEV__ ? [RemeshLogger()] : []
|
||||
})
|
||||
|
||||
const ui = await createShadowRootUi(ctx, {
|
||||
|
|
|
@ -408,10 +408,10 @@ const RoomDomain = Remesh.domain({
|
|||
// TODO: Move this to a service worker in the future, so we don't need to send a leave room message every time the page refreshes
|
||||
domain.effect({
|
||||
name: 'RoomOnUnloadEffect',
|
||||
impl: () => {
|
||||
impl: ({ get }) => {
|
||||
const beforeUnload$ = fromEvent(window, 'beforeunload').pipe(
|
||||
map(() => {
|
||||
return [LeaveRoomCommand()]
|
||||
return get(RoomJoinStatusModule.query.IsFinishedQuery()) ? LeaveRoomCommand() : null
|
||||
})
|
||||
)
|
||||
return beforeUnload$
|
||||
|
|
|
@ -43,6 +43,8 @@ const UserInfoDomain = Remesh.domain({
|
|||
const UpdateUserInfoCommand = domain.command({
|
||||
name: 'UserInfo.UpdateUserInfoCommand',
|
||||
impl: (_, userInfo: UserInfo | null) => {
|
||||
console.log('111', userInfo)
|
||||
|
||||
return [
|
||||
UserInfoState().new(userInfo),
|
||||
UpdateUserInfoEvent(),
|
||||
|
|
Loading…
Reference in a new issue