Fork me on GitHub
#hyperfiddle
<
2018-12-26
>
Dustin Getz12:12:02

(->>
         [[:db/add (:db/id val) :intent/def @user/better-def]]
         (hyperfiddle.ui.util/with-tx! ctx "$"))
@alexandrkozyrev with-tx! is a private API, Use hyperfiddle.api/tx-fn instead. with-tx! should only be available in debug/dev, because it is unsafe, it lets you stage anything. Really it shouldn't be available at all

alexandrkozyrev12:12:34

ok, it’s the old fiddle, before your “counter” example

Dustin Getz12:12:53

Think of it this way: in prod, you don't trust the user, so all the transactions have to be controlled by your fiddles. The tx-fn will run in the cloud rather than the browser, where it can't be tampered with

Dustin Getz13:12:24

This is unrelated to the error you are encountering btw, looking into it

alexandrkozyrev13:12:46

can I use props in hyperfiddle.ui/link call, smth like

alexandrkozyrev13:12:48

[hyperfiddle.ui/link :intent/def ctx “update” @user/better-def]

alexandrkozyrev14:12:49

when I try to use it (click “update” button) here http://alexandrkozyrev.hyperfiddle.net/:intent-bad-name-editor/17592186047106, I get “#object[TypeError TypeError: Cannot read property ‘call’ of undefined]” alert

Dustin Getz14:12:17

Hmm good question, no, the signature is (defmulti txfn (fn [user-txfn e a v ctx] user-txfn)) but i think you are right, this is an oversight and it should be supported

Dustin Getz14:12:02

For today you can use the ctx – (assoc ctx :user/better-def ...) and the same ctx is available in the txfn method

Dustin Getz14:12:26

I want to think about this more and will do something in janurary

alexandrkozyrev17:12:48

is it possible to add GA/gtag.js to a fiddle?

Dustin Getz17:12:26

what exactly are you referring to

Dustin Getz18:12:26

Do you just need a GA code, or do you need specifically gtag.js

Dustin Getz18:12:03

I will add a ticket to add a GA code on the subdomain admin panel

alexandrkozyrev19:12:07

I think GA code is enough