This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-16
Channels
- # ai (5)
- # announcements (47)
- # aws (11)
- # babashka (20)
- # beginners (85)
- # biff (1)
- # calva (72)
- # cider (9)
- # clj-kondo (37)
- # cljfx (9)
- # cljs-dev (1)
- # clojars (2)
- # clojure (61)
- # clojure-berlin (2)
- # clojure-europe (189)
- # clojure-nl (1)
- # clojure-norway (17)
- # clojure-uk (2)
- # clojurescript (51)
- # conjure (3)
- # cursive (4)
- # data-science (6)
- # datomic (6)
- # events (5)
- # fulcro (16)
- # gratitude (9)
- # holy-lambda (9)
- # introduce-yourself (6)
- # lsp (13)
- # malli (8)
- # membrane (2)
- # off-topic (47)
- # pedestal (11)
- # re-frame (15)
- # reitit (1)
- # releases (2)
- # rewrite-clj (6)
- # rum (4)
- # shadow-cljs (2)
- # tools-deps (3)
- # xtdb (25)
- # yada (13)
I'm have a loading marker that works when the page is already rendered, but it doesn't work the first time, when the page first loads. Any idea of why that might be? I am running in a detached subtree with hooks/use-root
.
I have the following components:
(fulcro-comp/defsc ForecastRow [_this _props]
{:query [:forecast/id :forecast/name]
:ident :forecast/id})
(fulcro-comp/defsc ForecastList [_this {:keys [forecasts-data] :as props}]
{:query [{:forecasts-data (fulcro-comp/query ForecastRow)}
[fulcro-fetch/marker-table 'ForecastList]]
:initial-state {:forecasts-data []}}
Hook:
(let [forecasts-data (fulcro-hooks/use-root fulcro/app :root/forecasts ForecastList {})]
(fulcro-comp/with-parent-context fulcro/app
(ui-forecast-list forecasts-data))
Loading:
(fulcro-fetch/load! fulcro/app :forecasts ForecastRow
{:target [:root/forecasts :forecasts-data]
:marker 'ForecastList})
The first time the page loads, I am always receiving forecasts-data
= nil, until the data is loaded. But then, if I do a reload, I do get the marker updates in forecasts-data
.
This is strange. I need to initialize the root-key
prior to the first load!, for marker updates to work.
(swap! (::fulcro-app/state-atom fulcro/app)
assoc :root/forecasts {})
It does work when using use-component
(with a constant ident) instead of use-root
. use-root
doesn't seem to start refreshing changes until its root-key is populated.
Could this be related to what I experienced of Dynamic Routing not working on use-root
, but working on use-component
?
General hooks support is newer and not as well-tested than the traditional Fulcro composition techniques. I still recommend using the older mechanisms as the primary composition technique, and reserve the use of hooks for cases where dynamism is actually needed.
The dynamic routing system is designed to use the queries (from the real mounted app root, often) for various features. I guarantee use-root
and dynamic routers will not be 100% compatible.
In terms of refresh of load marker: probably a bug. Im’ sure the load marker is going into state via load. Not sure why you’re getting a missed refresh on startup.
Thanks @U0CKQ19AQ. I'm not using detached roots as a way to structure the application, but as a means to progressively introduce Fulcro in an existing application.
Ah I see. Well I'm open to prs if you find an issue, or an issue with a simple reproducible problem. Eg make a repo with small example of problem that I can run and fix.
I would like to be able to refine report controls with more attributes. for example type="numeric" and others from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
So I should probably modify com.fulcrologic.rad.rendering.semantic-ui.controls.text-input
and define attributes on control?
ro/controls {
::xyz {:type :string
:label "xyz"
:attributes {:type "numeric"}}}
(dom/input (*merge*
*`attributes`*
{:readOnly (boolean disabled?)
:placeholder (str placeholder)
:onChange chg!
:onBlur (partial run! false)
:onKeyDown (fn [evt] (when (evt/enter? evt) (run! true evt)))
:value (str value)}))
Does anyone know what to change in Semantic UI classes so we get form buttons working on mobile? Notice that the buttons get overlaid by the form pane
This is strange. I need to initialize the root-key
prior to the first load!, for marker updates to work.
(swap! (::fulcro-app/state-atom fulcro/app)
assoc :root/forecasts {})
It does work when using use-component
(with a constant ident) instead of use-root
. use-root
doesn't seem to start refreshing changes until its root-key is populated.