This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-30
Channels
- # announcements (1)
- # beginners (94)
- # calva (12)
- # cider (5)
- # cljdoc (4)
- # cljs-dev (4)
- # clojure (170)
- # clojure-austin (2)
- # clojure-dev (45)
- # clojure-germany (53)
- # clojure-italy (20)
- # clojure-nl (6)
- # clojure-spec (25)
- # clojure-uk (242)
- # clojurescript (161)
- # cursive (16)
- # data-science (3)
- # datomic (20)
- # defnpodcast (6)
- # emacs (40)
- # events (1)
- # fulcro (80)
- # funcool (46)
- # jobs (1)
- # leiningen (23)
- # liberator (2)
- # lumo (43)
- # mount (3)
- # off-topic (21)
- # onyx (1)
- # pedestal (15)
- # re-frame (23)
- # reitit (4)
- # schema (1)
- # sfcljs (1)
- # shadow-cljs (167)
- # spacemacs (1)
- # tools-deps (21)
- # yada (2)
The class is working, just style doesn't working, Thanks.
@veddha.riady Try using [fulcro.client.localized-dom :as dom]
.
Instead of the classes version there you can just have :.textHeader
. I couldn't get className
to work at all.
Notice that Header
is queried by Root
and that Header
has a query, even though it doesn't need a query.
Generating the css follows the path of the query. So the query tree (upside down tree) has to go all the way to where you want the css.
hi all, Iām still trying to figure out why my component seems to refreshing to its default state, Iāve reworked my mutation as follows using df/load
but it still seems to flip everything back to default:
If you are doing a df/load
it should be outside a mutation. df/load-action
is for inside.
fwiw, removing the target prevents the refresh, but the data obviously loads in the wrong place
Good to concentrate just on the data. To not have to think about refresh issues: :reconciler-options {:render-mode :keyframe}
.
Can you show the defsc for [:space-details :global]
? Does it have a join in it called :calendar-events
, that joins to some other component?
I'm a bit confused actually. Normally I think you would just want to target a table - the table that has all the calendar events in it. In which case you would not need a :target
.
So on initial load, I populated the :calendar-events
, the mutation is when the user clicks on the next month and I fetch more data for that month
the data comes in, looks fine - but the UI switches back to the previous month (or default in this case which is new Date()
The UI is a product of the state, so good to know what state change is happening to cause that.
We need to see the component and the invocation pointā¦sharing a bit more code would be helpful @njj
not sure if this is enough, https://gist.github.com/njj/0d8f277cdc21de4da96fbc138d178dda
the data location is [:space-details :global :calendar-events]
, so I did the same for the :target
[ 39.556s] [fulcro.client.primitives] Component [object Object] threw an exception while rendering Error: No protocol method IMap.-dissoc defined for type cljs.core/PersistentVector: [:space-details :global]
I expected to see a join there. Is there a defui
for CalendarEvents? Is there a thing called a calendar event in your app?
And having the same key for the join and the load is a bit confusing. I know it is like that in the docs for the simplest case.
(defmethod api-read :fetch-calendar-events [env _ {:keys [space-id calendar-params]}] etc..
w/o :target or :refresh in the mutation, it causes the default state of the calendar component
(defmethod m/mutation 'space-details/fetch-calendar [{:keys [reconciler] :as env} _ {:keys [space-id calendar-params]}]
{:remote (m/remote-load env)
:action (fn []
(df/load-action env :fetch-calendar-events nil {:params {:space-id space-id
:calendar-params calendar-params}
:target [:space-details :global :some-random-key]
:marker false}))})
once I change that to :calendar-events
, it clears out the current calendar events (as expected), then flips the UI
I think it might work if the :calendar-events
that was returned was just a string "I am calendar events".
Just saying there needs to be a join to another another component at :calendar-events
.
Things have their own tables (thing/by-id) and other things point to them via idents.
Yes it can be. Not much in the way of error messages to help when you go 'off piste'. šæ
Much head scratching sometimes, but it is so good when you realise all the pain means you will always be able to reason locally about your app, not matter how huge it gets.
But the commentary about load/load-action still doesnāt seem to have been understood. You should replace the UI call to (transact! this '[(space-details/fetch-calendar ...)])
to a call to (load this :fetch-calendar-events ...)
. Thatās what I meant about not using load-action
ā¦what I meant was: itās a loadā¦so use load, not transact.
Iāve come up with a short term solution, the react calendar component was storing the selected month in its component local state. It has an option to pass a prop of the selected month, so Iām doing that now and tracking the data and the state of the month in my clojure app
So, if youāre using component-local state, all sorts of zany things can happen with load: You see, React can unmount/mount a component if it looks to be a ādifferent instanceāā¦and that can lose component-local state (which goes away on unmount). Chances are that was your problem, and not load at all.
yeah, the React community is getting wise to the āall input-like things should be controllableā
Just so you know: your earlier description of it going back in time was a good clue, but the reason it confused me is that Fulcro patches props for refresh, and 2.5.x had time-based logic to prevent odd cases that could happen of state looking like it went backwards. 2.6 no longer has this, but it hadnāt shown any bugsā¦but anyway, I was wondering if you had found a bug and needed to see more, but glad it turned out to be c.l. state. For such a simple use-case I would have expected a bug to have appeared long ago.