Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve repl support when updating supporting functions in repl #68

Open
phronmophobic opened this issue Feb 20, 2023 · 0 comments
Open

Comments

@phronmophobic
Copy link
Owner

Due to the way component caching works, re-evaling helper functions that are used by defui components, but aren't defui components will make it seem like something is broken.

(defn helper-fn []
  (ui/label "hi"))
(defui my-component [{}]
  (helper-fn))

(ui/children (my-component {}))
;; [{:text "hi",
;;   :font {:name nil, :size 14, :weight nil, :width nil, :slant nil}}]

;; re-eval
(defn helper-fn []
  (ui/label "hello"))
;; uses cache
(ui/children (my-component {}))
;; [#membrane.ui.Label{:text "hi", :font #membrane.ui.Font{:name nil, :size 14, :weight nil, :width nil, :slant nil}}]

;; re-eval
(defui my-component [{}]
  (helper-fn))
(ui/children (my-component {}))
;; [#membrane.ui.Label{:text "hello", :font #membrane.ui.Font{:name nil, :size 14, :weight nil, :width nil, :slant nil}}]

There are various ways to invalidate the cache so that this is more convenient when working at the repl.

  • debug mode that flushes cache regularly
  • better documentation
  • nrepl middleware
  • add a skia/debug-run that helps?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant