Fork me on GitHub
#hoplon
<
2016-10-04
>
lightbulb08:10:06

Hi Guys, I'm trying to update a project which is using hoplon 5.10.25 to 6.0.0alpha16. I've hit a problem where my Javelin formula cells when derefed are returning javelin.core/none. I am hoping someone could explain why a formula cell would give me this? A scenario where its causing me a problem is when I put the formula cell on a class of an html element.

micha12:10:27

@lightbulb can you make an example that demonstrates the problem?

micha12:10:01

you should never see that value in a cell

chromalchemy14:10:09

Hi guys. I'm trying to deploy a relatively simple app as an html fileset. I'm using Hoplon 6.0.0-alpha16 and the target task like so:

(deftask build-p []
 (comp
  (cljs :optimizations :none)
  (target :dir #{"C:/Users/rigalo/Dropbox/Apps/Heroku/h-budget"})))
I get main.js and main.out but no index.html. Any pointers?

chromalchemy14:10:09

Btw I've been using Windows for a while, and now Windows 10 with mostly success. Although I'm not really pushing any boundaries. I do get the WARNING: Use of undeclared Var hoplon.core/html-object warning when I use UI, even when I set, (:refer-hoplon :exclude [html-object]) But I havent notice it affect anything once the warnings settle down.

chromalchemy14:10:30

For my boot.properties I have

BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.7.0
BOOT_VERSION=2.6.0
BOOT_EMIT_TARGET=no

chromalchemy14:10:17

I'm assuming I need the index.html as an entry-point for all the js to run, correct?

chromalchemy14:10:15

Never mind, was just missing the (hoplon) boot task 😅

micha14:10:49

haha 👍

lightbulb15:10:11

@micha Thanks for getting in touch. I have just done a bit more testing using (.log js/console ...). I recorded this in a scratch buffer that i'll send. There's also an example of how this is causing me problems at the top.

lightbulb15:10:26

As the very basic (.log js/console @(cell= {:hidden true})) works at index.cljs.hl I think I need to keep testing all the way through the call stack until it stops working and then go from there.

lightbulb15:10:26

Its interesting you say that I should never see this from a cell. I couldn't find anything from googling this so I must just be doing something strange.

micha16:10:09

ah that makes sense then

micha16:10:33

you don't want to do @(cell= ...)

micha16:10:00

i am not sure what the issue you're seeing is actually

micha16:10:42

the @(cell= ... is ok

lightbulb17:10:16

I understand there is probably not a real use for this kind of thing @(cell= {:hidden true}) but i'm just using it too test where things start going wrong. I would think that derefing it immediately like this should still work though. This issue starts when secretary calls my view element. I did find if I wrap my (.log js/console @(cell= {:hidden true})) with the (with-init!) marco it then worked. I can't render my form inside a (with-init!) though.

micha17:10:05

yeah this is interesting

micha17:10:40

the cell= macro expands to something like ((formula ...) ...)

lightbulb17:10:27

Okay. I saw the source for that. I did think of trying to figure out how to use formula directly. I didn't think it would make any difference. I think this must be something wrong with my project though. I'll keep digging.

micha17:10:33

it's extremely odd that we haven't seen this before

micha17:10:54

yeah i don't think using formula would help

micha17:10:09

just trying to imagine what could be happening

micha17:10:26

it seems to be firing the watches before updating the formula

micha17:10:34

i'm not sure how that could happen

micha17:10:24

that's where the watcher is being fired

micha17:10:21

usually the ::none value can never be seen, because it's immediately and synchronously updated when propagate! is run

micha17:10:44

sorry i don't have a better answer

micha17:10:04

i'm interested to know what is going wrong there though

micha17:10:21

because it should be impossible to see :javelin.core/none

micha17:10:30

so osmething somewhere is not right

lightbulb17:10:02

I have seen it before I tried updating boot. It would happen if I had an error somewhere else on my page. Form fields would show none.

lightbulb17:10:20

At the moment though I'm not getting anything else logged to the console.

micha17:10:29

are you using the latest version of javelin?

lightbulb17:10:43

Yes. I checked my deps tree.

micha17:10:52

hm yeah i figured

micha17:10:16

so here is what happens when you create a formula

micha17:10:28

first it makes a new cell to hold the value

micha17:10:39

it initializes that with ::none, because it needs a value

micha17:10:10

then set-formula! is called to wire up the cell to the formula thunk and the cells the formula depends on

micha17:10:49

set-formula! does some arranging/rearranging to add the cell to the dependency graph

micha17:10:09

and then it calls propagate! on the cell to update its value

micha17:10:22

that's where things appear to go wrong

micha17:10:14

propagate! is a function that takes a cell that has just changed its value

micha17:10:55

propagate! then figures out which cells depend on that one, and computes a linear ordering of them

micha17:10:10

and updates each dependent cell in order

micha17:10:39

such that each cell is only updated after all the cells it depends on have already been updated

micha17:10:12

each cell that is being updated by propagate! might have watches on it

lightbulb17:10:16

can it work if there is no cells in the formula?

micha17:10:28

those are fired synchronously when the cell is updated

micha17:10:44

but only after the new value has been computed

micha17:10:04

yes it shouldn't care if the things it depends on are not cells

micha17:10:20

so cells or no cells should be the same

micha17:10:10

can you make a repo that demonstrates the issue?

micha17:10:26

i think i need to play around with it to fully understand what's going on

micha17:10:43

but this definitely seems like a serious issue

micha17:10:03

any kind of race condition needs to be ruthlessly terminated

lightbulb17:10:57

I will try to create a repo that demos this issue.

micha17:10:05

awesome thanks

lightbulb17:10:20

I image i will make that thing new and it will just work.

micha17:10:36

haha it will help you bisect the problem and maybe find what's wrong

lightbulb17:10:06

Yes very true.

micha17:10:07

but i thin kthere is definitely a bug in javelin somewhere

micha17:10:18

it really should be impossible to see ::none

lightbulb17:10:58

I need to pop out now but I will put something together. Later tonight or tomorrow. I'm in the UK.

lightbulb17:10:23

Thanks for the detailed break down of how this works though. Its very interesting.

micha17:10:24

sure, thanks for your help

micha17:10:33

and welcome, by the way 😄