Fork me on GitHub
#hoplon
<
2017-11-26
>
Ruben W00:11:49

yeah, but that is js based right.. (ns ^{:hoplon/page "index.html"} myprj.index generates the index.html

flyboarder00:11:38

correct, does base not work for you in javascript?

Ruben W00:11:01

hoplon generates the following html: <html><head><meta charset="utf-8"></head><body><script type="text/javascript" src="index.html.js"></script></body></html> From what I understand, any use of (base in my code will be defined in index.html.js, so its not applied since the js file is not found

flyboarder00:11:11

ah so you want base to happen as part of the raw html file, you would need a boot task that modified the file as part of the build

Ruben W00:11:36

check, or maybe just write the initial index.html by hand

Ruben W00:11:12

thanks for baring with me @flyboarder 🙂

flyboarder00:11:49

@freakinruben no problem, can you confirm that the base element doesnt work from javascript?

Ruben W00:11:04

yeah, tried it already

Ruben W00:11:20

(h/base :href "")

flyboarder00:11:36

does that correctly insert the element but not function?

Ruben W00:11:25

no it functions correctly once the javascript file is loaded

flyboarder00:11:13

perhaps we need a task for boot with extra options, more control over the raw html page

flyboarder00:11:49

or we could add that meta data to the current task

Ruben W00:11:20

well, it’s very specific to SPA’s.. normal usecase for generated hoplon pages is that they’re actually different html pages. In that case it works fine

Ruben W00:11:51

but having the option to customise the raw html would be great yeah

flyboarder00:11:29

@freakinruben i would say the current best bet would be to not use the hoplon generated page and do it like a regular cljs app

flyboarder00:11:06

ie. provide you own index.html

Ruben W12:11:46

What is the preferred way to rerender a ‘component’ when the content of the cell I give it changes? Example of component:

(defn my-component [a-cell]
  (h/div (h/span (:title a-cell))))

(def state {:cache (atom {:my-component (cell nil)})})

(load-data :my-component)
(my-component (:my-component @(:cache state)))
I want to render the component initially and re-render it when the data is loaded from the server, which is then set into the initially provided cell. In the above example, my-component is only rendered once, and not re-rendered

Ruben W13:11:58

Gonna answer my own question, making cache a cell and using a formula to derive the data to render for the component seems to work

alandipert19:11:38

freakinruben yup thats what i would have suggested... passing a cell in to the component