yeah, but that is js based right..
(ns ^{:hoplon/page "index.html"} myprj.index
generates the index.html
correct, does base
not work for you in javascript?
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
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
check, or maybe just write the initial index.html by hand
thanks for baring with me @flyboarder 🙂
@freakinruben no problem, can you confirm that the base element doesnt work from javascript?
yeah, tried it already
(h/base :href "<http://localhost/>")
does that correctly insert the element but not function?
no it functions correctly once the javascript file is loaded
perhaps we need a task for boot with extra options, more control over the raw html page
or we could add that meta data to the current task
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
but having the option to customise the raw html would be great yeah
@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
ie. provide you own index.html
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-renderedGonna answer my own question, making cache a cell
and using a formula to derive the data to render for the component seems to work
freakinruben yup thats what i would have suggested... passing a cell in to the component