hyperfiddle-2020 icon indicating copy to clipboard operation
hyperfiddle-2020 copied to clipboard

hf/tx abstraction missing

Open dustingetz opened this issue 5 years ago • 0 comments

This pattern keeps coming up, where the fiddle defn returns nil as it is simply a prompt that collects parameters for a transaction. Should the hf/tx be directly routable?

(defn ^::hf/fiddle alias-to [sub user] nil)

(defmethod hf/view-defaults `alias-to [sub user]
  [sub (d/pull hf/*$* [:db/id] *suber-user*)]) ; for display

(defmethod hf/tx (keyword `alias-to) [ctx [e a v] props popover-ctx]
  #?(:cljs
     (let [[_ sub suber-user] @(:hypercrud.browser/route-defaults-symbolic popover-ctx)]
       ; Server resolves suber-user for security
       [`(alias-me ~sub)])))

dustingetz avatar Sep 13 '20 18:09 dustingetz