(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?It also throws if ^js before bound symbol:
(when-let [^js el-popover @!popover-element]
(.hidePopover el-popover))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.Resolved by wrapping in a redundant (e/client ...) inside (e/client ...), which feels like a siting bug.
Does e/on-unmount apply to the current dom/node, or the parent e/fn component?
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).
> This includes the (e/On-unmount ...) expression
what's the use case for e/On-unmount (vs e/on-unmount)? any code examples? 👀
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
thanks – the lifecycle supervision is great!