hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
Ruben W 2017-11-26T00:00:49.000024Z

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

flyboarder 2017-11-26T00:01:38.000004Z

correct, does base not work for you in javascript?

Ruben W 2017-11-26T00:03:01.000058Z

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

flyboarder 2017-11-26T00:04:11.000032Z

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 W 2017-11-26T00:04:36.000039Z

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

Ruben W 2017-11-26T00:05:12.000024Z

thanks for baring with me @flyboarder 🙂

flyboarder 2017-11-26T00:05:49.000053Z

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

Ruben W 2017-11-26T00:06:04.000042Z

yeah, tried it already

Ruben W 2017-11-26T00:06:20.000032Z

(h/base :href "<http://localhost/>")

flyboarder 2017-11-26T00:06:36.000003Z

does that correctly insert the element but not function?

Ruben W 2017-11-26T00:07:25.000029Z

no it functions correctly once the javascript file is loaded

flyboarder 2017-11-26T00:09:13.000067Z

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

flyboarder 2017-11-26T00:10:49.000014Z

or we could add that meta data to the current task

Ruben W 2017-11-26T00:11:20.000034Z

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 W 2017-11-26T00:11:51.000014Z

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

flyboarder 2017-11-26T00:32:29.000072Z

@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

flyboarder 2017-11-26T00:33:06.000043Z

ie. provide you own index.html

Ruben W 2017-11-26T12:39:46.000038Z

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 W 2017-11-26T13:08:58.000032Z

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

2017-11-26T19:52:38.000040Z

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