浏览代码

improve(api): event hook of after graph indexed

charlie 3 年之前
父节点
当前提交
09d43983f2
共有 2 个文件被更改,包括 2 次插入0 次删除
  1. 1 0
      libs/src/LSPlugin.ts
  2. 1 0
      src/main/frontend/handler/events.cljs

+ 1 - 0
libs/src/LSPlugin.ts

@@ -412,6 +412,7 @@ export interface IAppProxy {
 
   // hook events
   onCurrentGraphChanged: IUserHook
+  onGraphAfterIndexed: IUserHook<{repo: string}>
   onThemeModeChanged: IUserHook<{ mode: 'dark' | 'light' }>
   onThemeChanged: IUserHook<Partial<{name: string, mode: string, pid: string, url: string}>>
   onBlockRendererSlotted: IUserSlotHook<{ uuid: BlockUUID }>

+ 1 - 0
src/main/frontend/handler/events.cljs

@@ -59,6 +59,7 @@
   (db/set-key-value repo :ast/version db-schema/ast-version)
   (search-handler/rebuild-indices!)
   (db/persist! repo)
+  (plugin-handler/hook-plugin-app :graph-after-indexed {:repo repo :empty-graph? empty-graph?})
   (when (state/setups-picker?)
     (if empty-graph?
       (route-handler/redirect! {:to :import :query-params {:from "picker"}})