hyperfiddle

braai engineer 2025-09-28T15:22:29.082689Z

(when-let [el-popover @!popover-element]
  (.hidePopover el-popover))
throws,
Cannot infer target type in expression (. el-popover hidePopover)
but when I add a ^js hint,
(when-let [el-popover @!popover-element]
  (.hidePopover ^js el-popover))
Electric throws:
Error in phase :compile-syntax-check
IllegalArgumentException: Unable to resolve classname: js
What's the right way to specify JS type hints for DOM elements?

braai engineer 2025-09-28T15:23:38.935539Z

It also throws if ^js before bound symbol:

(when-let [^js el-popover @!popover-element]
  (.hidePopover el-popover))

braai engineer 2025-09-28T15:25:22.857299Z

But does not throw in this case:

(dom/On "focus" (fn [e]
                  (.preventDefault e)
                  (.stopPropagation e)
                  (when-let [el @!popover-element]
                    (.showPopover ^js el))
                  nil)
  nil)
Both are in e/client.

braai engineer 2025-09-28T15:30:47.163269Z

Resolved by wrapping in a redundant (e/client ...) inside (e/client ...), which feels like a siting bug.

👀 1
braai engineer 2025-09-28T16:24:11.237369Z

Does e/on-unmount apply to the current dom/node, or the parent e/fn component?

Geoffrey Gaillard 2025-09-28T22:18:27.389909Z

e/on-unmount is unrelated to dom/node, and applies to the current "branch": • Current e/fn body • Current if/when/case conditional branch • Current e/for branch • Etc. Anywhere there can be a (prn "mount"), e/on-unmount will run when the "branch" who triggered (prn "mount") to run (on mount) is discarded (unmounting).

👍 1
⚡ 1
Piotr Roterski 2025-09-30T18:21:34.188169Z

> This includes the (e/On-unmount ...) expression what's the use case for e/On-unmount (vs e/on-unmount)? any code examples? 👀

Dustin Getz (Hyperfiddle) 2025-09-29T12:22:37.782299Z

due to fine-grained reactivity, each individual expression has an unmount lifecycle (as opposed to react, which has function-level granularity). This includes the (e/On-unmount ...) expression itself which can be confusing

braai engineer 2025-09-29T12:23:07.117089Z

thanks – the lifecycle supervision is great!