Fork me on GitHub
#hyperfiddle
<
2018-08-10
>
miridius03:08:13

I was thinking on the lines of testing my app's functionality, for example test cases like "when a user opens the start page, inputs search term X and presses enter, they should see results page Y"

miridius03:08:12

I think the fact that a) you guys already have written functionality for forking the datomic DB to do speculative writes and b) all fiddles are data (even when rendered, I think?) should give a nice head start when it comes to implementing tests for an app

miridius03:08:44

but I was interested if you've already put some thought into how your users might do that

miridius03:08:19

building a test runner as its own fiddle would be pretty cool!

miridius03:08:10

@dustingetz my domain config reset itself again. Although this time auto-transact stayed on

Dustin Getz12:08:19

@miridius We thought we fixed that yesterday so maybe I misunderstood what was happening, can you screenshot your domain config, with the staging area open? I have a feeling this is a problem of unclear UX or maybe a UI bug BTW we look at analytics to know when the coast is clear to deploy, so if you do whitelist us in your adblocker that will help us not deploy while you are in the middle of stuff.

miridius14:08:16

@dustingetz ok will do if it happens again. So far today it seems to be holding 🙂

Dustin Getz15:08:24

Can you screenshot your domain page for me now or next time you work, with the stage open

miridius16:08:26

it was a bit different back on Wednesday though in that the stage button was yellow (Even though staging area was empty and auto-transact turned on)

miridius16:08:22

what I think is quite possible is that I just had too many different hyperfiddle tabs open for too long (like almost a week) and caused some weird quirk

miridius16:08:38

@dustingetz it seems to be working fine now in any case 🙂

Dustin Getz16:08:19

We haven't deployed since i think weds night

Dustin Getz16:08:09

Looking at that screen, i dont understand how it is possible to lose any info from domain under any circumstances, since it is all transacted, so let me know if something weird happens again. I can't explain your data loss

Dustin Getz16:08:19

Ah, the extra tabs maybe

Dustin Getz16:08:59

As of weds night we don't wipe the staging area on deploy anymore to prevent this kind of issues you had, so this should not be an issue again, i just wish i understood what happened thursday night

miridius17:08:49

it might be the lots of tabs + also I'm using mobile internet so there's probably some network hiccups

miridius17:08:15

anyway if it happens again I'll let you know, but even if it does it's not a huge deal

Dustin Getz14:08:28

middle click has caused all sorts of problems on windows and linux so I am gonna remove it. We will just have alt-click for "inspect source". We will make data mode better to get the "show me the admin interface" use case back.

miridius17:08:36

is there another way to pass arguments (parameters, props, whatever) to a nested fiddle besides assoc-ing some keys to the ctx map? For example, I have a :footer fiddle which looks like this:

(letfn [(footer-link [title link first?]
          [hyperfiddle.ui/browse :footer/link []
           (assoc ctx :footer.link/title title
                      :footer.link/link link
                      :footer.link/first? first?)])]
  [:footer.fixed.bottom-0.w-100.bg-ivy-blue.white.pv1
   [:
    (footer-link "About Us" "/:index/:about-us" true)
    (footer-link "Contact" "/:index/:contact" false)
    (footer-link "Impressum" "/:index/:impressum" false)
    (footer-link "Terms" "/:index/:terms" false)]])
And then :footer/link looks like this:
(let [{:keys [:footer.link/title
              :footer.link/link
              :footer.link/first?]} ctx]
  [:div.fl.w-25.tc.f7 (when-not first? {:class "bl"})
   [:a.white.no-underline.underline-hover
    {:href link} title]])
That works perfectly, but it's quite a lot of code just to pass some static arguments. Perhaps I'm over-engineering things by making a separate footer fiddle in this case and I should just use a function. But there's probably situations where you do want to pass arguments to a child reagent component so it would be a nice to have (not a requirement) if that were easy

Dustin Getz19:08:20

@miridius If the footer doesn't have data dependencies, I would recommend you just use clojurescript functions here, the fiddle datamodel is meant to model the API and pass parameters into datomic arguments

Dustin Getz19:08:43

@miridius I think if you have datomic arguments AND render arguments (the what-if you describe), you would want the data API – basically the parent fiddle, instead of "iframing" the child fiddle, will call hyperfiddle.data/browse to just get the child api results as EDN and then render it from the parent render function

Dustin Getz19:08:44

I will add cookbooks for this in the next documentation sprint – we have been making improvements and simplifications to the data api this week

Dustin Getz19:08:53

(This is basically how select options work, btw, and is related to your question of "how do i sort picklists")

Dustin Getz19:08:04

Actually, in master I see that iframes have props now which will work too – but this is an area of churn as we tighten up the clojurescript ui programming model