This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-27
Channels
- # admin-announcements (1)
- # announcements (11)
- # babashka (17)
- # beginners (26)
- # calva (6)
- # cider (2)
- # circleci (1)
- # clojure (41)
- # clojure-dev (1)
- # clojure-europe (31)
- # clojure-france (2)
- # clojure-italy (10)
- # clojure-nl (7)
- # clojure-norway (5)
- # clojure-spec (15)
- # clojure-uk (42)
- # clojurescript (4)
- # code-reviews (12)
- # conjure (10)
- # datalog (2)
- # datascript (15)
- # datomic (37)
- # emacs (1)
- # events (5)
- # fulcro (19)
- # jobs (1)
- # jobs-discuss (9)
- # kaocha (2)
- # luminus (14)
- # meander (4)
- # membrane (39)
- # off-topic (26)
- # other-languages (2)
- # re-frame (13)
- # reitit (6)
- # rewrite-clj (39)
- # sci (6)
- # shadow-cljs (33)
- # test-check (15)
- # vrac (17)
- # xtdb (7)
Anyone have a clue as to what's going on here??
;; in the namespace: :be.produktiv.task-records.ui.task-record-item
;; there is this component:
(defsc TaskRecordItem
[_ _]
{:ident :task-record/id
:query [:task-record/id
{:task-record/subtask-records '...}
:task-record/duration
:task-record/description
:task-record/date
:task-record/scheduled-at
:task-record/recorded-at
:task-record/state
:ui/expanded?]})
;; in a mutations namespace I have the following:
(defn TaskRecordItem [] (c/registry-key->class :be.produktiv.task-records.ui.task-record-item/TaskRecordItem))
;; I'm trying to merge in a tree of task-records that have subtask-records.
;; note the incoming nested task-record has state :complete
;; The client db has the existing task-record in an incomplete state
(merge/merge-component {:task-record/id {#uuid "e1e6eff8-7443-4b9b-a77f-fa8db0578127"
{:task-record/state :incomplete
:task-record/id #uuid "e1e6eff8-7443-4b9b-a77f-fa8db0578127"}}}
(TaskRecordItem)
{:task-record/id #uuid "9d366519-70eb-4303-aafd-b31a2c4ac8a4",
:task-record/state :incomplete,
:task-record/subtask-records
[{:task-record/id #uuid "e1e6eff8-7443-4b9b-a77f-fa8db0578127",
:task-record/date #time/date "2020-08-26",
:task-record/recorded-at #time/date-time "2020-08-26T21:35:18.453",
:task-record/state :complete,
:ui/expanded? false,
:task-record/subtask-records []}]})
;; output =>
{:task-record/id {#uuid"e1e6eff8-7443-4b9b-a77f-fa8db0578127" {:task-record/state :incomplete,
:task-record/id #uuid"e1e6eff8-7443-4b9b-a77f-fa8db0578127",
:ui/expanded? false,
:task-record/date #time/date"2020-08-26",
:task-record/recorded-at #time/date-time"2020-08-26T21:35:18.453",
:task-record/subtask-records []},
#uuid"9d366519-70eb-4303-aafd-b31a2c4ac8a4" {:ui/expanded? false,
:task-record/id #uuid"9d366519-70eb-4303-aafd-b31a2c4ac8a4",
:task-record/state :incomplete,
:task-record/subtask-records [[:task-record/id
#uuid"e1e6eff8-7443-4b9b-a77f-fa8db0578127"]]}}}
;; note the nested subtask-record is not getting updated (it is still :incomplete)
Now the weird(er) part:
if I copy the component definition into the mutation file and do not use the component registry, the merge-component call works properly...
(defsc TaskRecordItem
[_ _]
{:ident :task-record/id
:query [:task-record/id
{:task-record/subtask-records '...}
:task-record/duration
:task-record/description
:task-record/date
:task-record/scheduled-at
:task-record/recorded-at
:task-record/state
:ui/expanded?]})
(merge/merge-component {:task-record/id {#uuid "e1e6eff8-7443-4b9b-a77f-fa8db0578127"
{:task-record/state :incomplete
:task-record/id #uuid "e1e6eff8-7443-4b9b-a77f-fa8db0578127"}}}
TaskRecordItem ; <-- using the component defined in the mutations file.
{:task-record/id #uuid "9d366519-70eb-4303-aafd-b31a2c4ac8a4",
:task-record/state :incomplete,
:task-record/subtask-records
[{:task-record/id #uuid "e1e6eff8-7443-4b9b-a77f-fa8db0578127",
:task-record/date #time/date "2020-08-26",
:task-record/recorded-at #time/date-time "2020-08-26T21:35:18.453",
:task-record/state :complete,
:ui/expanded? false,
:task-record/subtask-records []}]})
;; output =>
{:task-record/id {#uuid"e1e6eff8-7443-4b9b-a77f-fa8db0578127" {:task-record/state :complete, <---------- and the state is set correctly
:task-record/id #uuid"e1e6eff8-7443-4b9b-a77f-fa8db0578127",
:task-record/date #time/date"2020-08-26",
:task-record/recorded-at #time/date-time"2020-08-26T21:35:18.453",
:ui/expanded? false,
:task-record/subtask-records []},
#uuid"9d366519-70eb-4303-aafd-b31a2c4ac8a4" {:task-record/id #uuid"9d366519-70eb-4303-aafd-b31a2c4ac8a4",
:task-record/state :incomplete,
:task-record/subtask-records [[:task-record/id
#uuid"e1e6eff8-7443-4b9b-a77f-fa8db0578127"]]}}}
I am not even sure where to begin debugging this, but thought I'd bring it up. My strategy going forward is to make a shared namespace of queries and define the component definition twice...I've got no idea what's going on anymore. I just replicated the tree of queries in the mutations namespace for now and things are working... What a mess
Still have no idea - but I'm instead computing a tree of data and then converting to db using tree->db and then assoc-in'ing the tables that I care about..
I'm looking in to using workspaces, eventually got some of the examples working with the com.github.awkay/workspaces
version but two issues remain:
• no inspector, even though my build includes the preload
• every time I refresh workspaces, the layout is lost
Am I missing something?
I had problems with inspector this week, maybe the thread will help you https://clojurians.slack.com/archives/C68M60S4F/p1598021142026100
I have a component for a "Project" with :route-segment ["project" :id]
I can route to it via (rroute/route-to! this Project {:id id})
(rad router) just fine, However, I can't pageload to a project with just, say, /project/ffffffff-ffff-ffff-ffff-000000000300
it seems that the query params tacked on by route-to!
are required -- how would one allow users to pageload to that view without query params?
i guess i could transform the url by hand to the expected route / param combo on start-up?
Fulcro routing is not hooked into URL at all. Look at RAD how it does it
could you say more about that? I'm based off of the RAD demo -- page-loading to URLs that correspond to route segments definitely takes me there
for example, if i go to
, I'll get routed to the accounts report
Ah, ok, I didn't get that. Then it's just about studying the code...
tony responded below, it sounds like a bug, ive been working through the code
@tylernisonoff so this is a standing issue: params should not be required, but I have not had time to deal with it.
its a standard component -- not a form/report
good to know its a standing issue! Any advise if of where to start if I wanted to look into fixing? (I know I still have the other PR to wrap up 😛, but maybe after)