فهرست منبع

fix: undefined events

Adam 10 ماه پیش
والد
کامیت
2c70c0b00f
2فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 1 0
      packages/desktop/src/context/global-sync.tsx
  2. 2 2
      packages/desktop/src/context/notification.tsx

+ 1 - 0
packages/desktop/src/context/global-sync.tsx

@@ -138,6 +138,7 @@ export const { use: useGlobalSync, provider: GlobalSyncProvider } = createSimple
     }
 
     globalSDK.event.listen((e) => {
+      console.log(e)
       const directory = e.name
       const event = e.details
 

+ 2 - 2
packages/desktop/src/context/notification.tsx

@@ -51,6 +51,7 @@ export const { use: useNotification, provider: NotificationProvider } = createSi
     // })
 
     globalSDK.event.listen((e) => {
+      console.log(e)
       const directory = e.name
       const event = e.details
       const base = {
@@ -58,8 +59,7 @@ export const { use: useNotification, provider: NotificationProvider } = createSi
         time: Date.now(),
         viewed: false,
       }
-      console.log(event)
-      switch (event.type) {
+      switch (event?.type) {
         case "session.idle": {
           const sessionID = event.properties.sessionID
           const [syncStore] = globalSync.child(directory)