Fork me on GitHub
#portal
<
2024-02-16
>
dumrat06:02:54

I frequently write stuff like this:

(defn some-fn [arg1 arg2]
  ...
  (tap> {:in `some-fn :arg1 arg1 :arg2 arg2 :some-local-val some-local-val})
...
Is there some helper that'd just let me say: (mytap> ['arg1 'arg2 'some-local-val])?

Bastian09:02:04

I recently tried https://github.com/beoliver/wiretap to log arguments and return values of functions, doesn't tap local values though

seancorfield17:02:54

There are several macros like https://github.com/worldsingles/commons/blob/master/src/ws/clojure/extensions.clj#L152 that produce a hash map of all locals (incl. arguments) so (tap> (ws/local-map)) might be an option?

đź‘Ť 1
chromalchemy21:02:05

Is there any way to inject a <style> tag in portal hiccup viewer for previewing components that have external styles?

djblue04:02:43

Currently, the easiest way is to include the styles in a style tag in the hiccup itself:

[:<> [:style ...] [:div ...]]

đź‘Ť 1
djblue04:02:19

I am open to alternatives if you have some ideas đź‘Ś

chromalchemy20:02:04

That is what I intuitively tried first. What threw me off was that, subsequent taps, rendering hiccup to the portal window, would not override previously rendered css. Ex. If I rendered green text on the first tap, then it would not change on subsequent taps. But I see now that If i p/clear , then I get a fresh css context. Now using some config you provided me before, to only show the last result in the window. This fulfills my goal to preview html + non-inline css!

(def last-tap (atom nil))
(defn clear-submit [value] 
  (reset! last-tap value))
(p/inspect last-tap {:launcher :vs-code})
(add-tap (var clear-submit))

chromalchemy20:02:27

Any insight into why the normal tap results are not isolated?, I thought each would be it’s own “webview”.