Fork me on GitHub
#hoplon
<
2017-07-05
>
cycle33700:07:05

because right now I got to a point where I have different app-state :data on each :page change but this doesn't trigger a re-render, basically if I press on page 2 it stays with page2 data rendered, even though app-state :data changes subsequently

micha00:07:34

that's odd

micha00:07:47

you have formula cells that depend on the parts that change?

micha00:07:59

and they aren't updating the way you expect?

cycle33700:07:29

i'm using a for-tpl [d data]

cycle33700:07:54

where data is yet again globally define as a (path-cell app-state [:data])

micha00:07:48

seems like you should see things changing if data changes

cycle33700:07:38

yeah ... more so because it works the first time I click on any page

cycle33700:07:50

but then stops working

micha00:07:03

can you paste the for-tpl you have

cycle33700:07:10

and as I said, it brings that page's data correctly

cycle33700:07:37

(tbody
                                 (for-tpl [d data]
                                   (single-data-row :d d))
                                 (div :class "row"
                                      (div :class "col-md-12
                                                  d-flex
                                                  justify-content-center
                                                  dash-pag-nav")))

cycle33700:07:45

where (single-data-row is just a function that writes multiple td's

cycle33700:07:24

data is global, not props passed to component where above code resides

cycle33700:07:59

also, I'm doing the ajax-request function when the route changes to #some-table-list but with a page param, perhaps that's why it's not triggering a re-render ... although app-state :data IS changing ...

micha00:07:53

can you paste the definitoin of single-data-row please?

thedavidmeister03:07:06

@flyboarder how did you go? any progress?

cycle33704:07:04

well ... I'm still trying to work it out

cycle33704:07:13

no succes yet

thedavidmeister04:07:30

oh, i was asking about something else actually 🙂

thedavidmeister05:07:23

i think we need to see what single-data-row is doing to help more with ^^

cycle33705:07:21

haha sorry 🙂 haven't had my coffee yet, seems you weren't talking to me

cycle33705:07:29

well here it is

(defelem single-data-row [{:keys [d]} _]
  (tr
      (td (:name @d))
      (td (:name_2 @d))
      (td (:address @d))
      (td (:email @d))
      (td (a (img :src (:image @d)))
      (td (a :href (str "#manage?id=" (:id @d))
             "Manage")))))

cycle33705:07:22

this happens for 10 items in the app-state :data []

cycle33705:07:13

i can't understand why this works for the first request only

cycle33706:07:58

i keep google-ing into the archives of unpaid discoursehosting :((

cycle33707:07:20

so, anything ?

dm307:07:21

you deref the cell

dm307:07:33

that’s why it only works the first time around

dm307:07:47

it has to be (td (cell= (:name d)))

cycle33707:07:14

thanks @dm3 it works for almost all the fields

cycle33707:07:16

the only issue is now i can't build my #manage?id=[object Object] hrefs

dm307:07:34

(cell= (str ....))

dm307:07:50

the attribute of a DOM element must be a cell

dm307:07:58

otherwise it won’t change when your data changes

cycle33707:07:45

oh this is great !

cycle33707:07:01

I'm feeling the Hoplon JOY !

thedavidmeister10:07:06

yeah, if in doubt, just wrap it in a cell=

thedavidmeister10:07:22

you'll get the feel for what really needs it and what doesn't as you practise

alandipert14:07:39

oh dang, hadn’t realized that happened

alandipert14:07:57

re discourse, i’ll figure it out with micha

micha14:07:26

oh dang, sorry!

micha14:07:57

my cc number was changed cause of fraud

micha14:07:01

i'll update it

alandipert14:07:44

@micha do we want to perhaps move to another host? i was looking and 20/mo seems on the pricy side

alandipert14:07:03

or perhaps we could set up a way to chip in

micha14:07:50

would that interfere with search engines finding the new location?

alandipert14:07:59

i imagine it would

micha14:07:02

or is that not so critical?

alandipert14:07:19

we coudl perhaps start by putting it behind DNS we own

alandipert14:07:30

and maybe they have stuff set up to do the redirects etc

dm314:07:36

someone can also go through all the questions and extract valuable stuff into Github wiki… someone with a lot of free time

dm314:07:05

to centralise the knowledge base in github wiki+issues

micha14:07:09

we really need a book maybe

micha14:07:37

there aren't sooo many things to cover really

alandipert14:07:11

i think moving away from .cljs.hl will be good for learning and teaching, i felt it really complicated explanations of everything

micha14:07:17

yeah totally

micha14:07:28

and javelin should not introduce macros till the end

micha14:07:10

like ((formula +) a b c) vs (cell= (+ a b c))

alandipert14:07:52

i had an idea about javelin the other day

micha14:07:08

oh? what was it?

alandipert14:07:10

first-classing the graph

alandipert14:07:37

(def g (graph)) (.cell g 123)

alandipert14:07:22

and graphs can’t depend on eachother, you get exception

alandipert14:07:57

the idea is that you often want to make isolated machines in components, and can run into difficult perf/bug territory because what you do in there can have global implications if you accidentally wire to something else

alandipert14:07:47

you could also call (.destroy g) and then accesses/resets to cells in g are exceptions

micha14:07:09

or the references become constants

micha14:07:44

in my ide thing i am thinking that when you delete a cell from the graph its value becomes an exception

micha14:07:01

and all the formulas that reference it then have their values being the exception

micha14:07:08

like in excel

alandipert14:07:13

totally, or FL

micha14:07:21

but i'm not sure that makes sense in general

micha14:07:39

it's good for debugging and development

alandipert14:07:40

i think you can address it if the dependency exceptions show a path to the original

alandipert14:07:46

like a stack trace kinda

micha14:07:52

yeah that's where the ide comes in

micha14:07:59

it will show like #ERR or whatever

alandipert14:07:21

i can imagine hovering over it and it telling me which of its dependencies was also ERR

micha14:07:30

right cause it could be more than one

micha14:07:45

my current thinking is sort of like FL

micha14:07:12

if any dependency has a value of #ERR then the formula will evaluate to #ERR also

micha14:07:36

and if there is an exception while evaluating the formula then it will evaluate to #ERR

alandipert14:07:12

would ERR have metadata on it about the exception/provenance?

alandipert14:07:23

i suppose it must for the ide to do its thing

micha14:07:32

i don't think there is a need really

micha14:07:41

because the ide will be able to look at the sources and sinks etc

micha14:07:43

of the cell

micha14:07:50

so it can figure all the things out

micha14:07:53

i am thinking #ERR would be the exception object

micha14:07:29

you'd want to remove all that when you run it in production i think

micha14:07:46

if it's really true that try/catch interferes with the JIT

flyboarder15:07:48

@thedavidmeister yes I have made some progress

flyboarder15:07:13

Long time no see :P

flyboarder17:07:36

@thedavidmeister I am working on getting you a code snippet

flyboarder18:07:18

data -> sorted data -> indexed data -> lense

flyboarder18:07:16

so from my abstraction of this, I think we can generalize both the sort and index of the data, and provide a single cell that would handle these cases for us

flyboarder18:07:36

I’ll throw a few variations on that sort in hoplon/brew

flyboarder18:07:38

I think the take away here is that all of the state should be contained within the tracked cell for -tpl macros, if you need to modify state then that cell needs to be a lense, otherwise move the portion that changes state into an element and use that element in the macro

flyboarder20:07:12

I ended up splitting the two steps apart as I think indexing a collection is generally useful for cells, indexed-cell will only index the data while sorted-cell will sort+index the data

flyboarder20:07:14

if you need custom sorting sorted-cell has a signature for sort which is used with sort-by as a keyfn