Skip to content

Commit

Permalink
fix: only add menu update to hook once kubeconfig cache init'd
Browse files Browse the repository at this point in the history
  • Loading branch information
jinnovation committed Apr 13, 2024
1 parent 4b7c3e5 commit 22e19eb
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions kele.el
Original file line number Diff line number Diff line change
Expand Up @@ -1248,13 +1248,18 @@ This is idempotent."
(unless kele--enabled
(setq kele--enabled t)
;; FIXME: Update the watcher when `kele-kubeconfig-path' changes.
(kele--cache-start kele--global-kubeconfig-cache :bootstrap t)
;; FIXME: Update the watcher when `kele-cache-dir' changes.
(kele--cache-start kele--global-discovery-cache :bootstrap t)

(add-hook 'menu-bar-update-hook 'kele--update-contexts-menu)

(kele--setup-embark-maybe)))
(let ((kubeconfig-future (kele--cache-start
kele--global-kubeconfig-cache
:bootstrap t)))
;; FIXME: Update the watcher when `kele-cache-dir' changes.
(kele--cache-start kele--global-discovery-cache :bootstrap t)

(kele--setup-embark-maybe)

;; menu bar update requires kubeconfig cache to be populated, so we wait
;; for the sync to complete here
(async-wait kubeconfig-future)
(add-hook 'menu-bar-update-hook 'kele--update-contexts-menu))))

(defun kele--disable ()
"Disable Kele functionality.
Expand Down

0 comments on commit 22e19eb

Please sign in to comment.