This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-18
Channels
- # announcements (2)
- # aws (3)
- # beginners (35)
- # boot (10)
- # cider (33)
- # cljs-dev (22)
- # clojure (58)
- # clojure-belgium (1)
- # clojure-europe (8)
- # clojure-houston (1)
- # clojure-italy (47)
- # clojure-nl (2)
- # clojure-spec (4)
- # clojure-uk (39)
- # clojurescript (12)
- # cursive (18)
- # data-science (1)
- # datomic (2)
- # emacs (24)
- # figwheel-main (29)
- # fulcro (24)
- # hoplon (14)
- # juxt (6)
- # kaocha (3)
- # nrepl (6)
- # off-topic (64)
- # om (1)
- # om-next (1)
- # pathom (21)
- # pedestal (18)
- # planck (40)
- # protorepl (1)
- # re-frame (15)
- # reagent (7)
- # reitit (16)
- # shadow-cljs (184)
- # spacemacs (4)
- # test-check (33)
I’m trying to use dynamic routing, but on initial load I can’t see the ident I’m giving to a defsc-route-target
in the normalized database
I have
(defrouter RootRouter
[this props]
{:router-targets [CompanyDashboard CompanyDetails]})
and
(defsc-route-target CompanyDashboard [this {:keys [all-companies] :as props}]
{:ident (fn [] [:COMPONENT/by-id :company-dashboard])
:query [{:all-companies (prim/get-query CompanyQuery)}]
:route-segment (fn [] ["dashboard-empresa"])
:route-cancelled (fn [_])
:will-enter (fn [reconciler _]
(dr/route-deferred ["dashboard-empresa"]
#(df/load reconciler :all-companies CompanyQuery
{:post-mutation `dr/target-ready
:post-mutation-params {:target [:COMPONENT/by-id :company-dashboard]}})))
:will-leave (fn [_] (js/console.log "Leaving company dashboard") true)}
(dom/div
(count all-companies)))
the route-deferred
part is issuing the load correctly, but CompanyDashboard
is not updating the all-companies
data structure (ie. (= (count all-companies) 0)
always in the UI
all-companies
is getting populated at the root level, maybe that’s why?
assoc’ing the data in [:COMPONENT/by-id :company-dashboard [ [ ... ] ]]
but same behavior
Is anyone aware of a vanilla JS library that takes the om.next/fulcro approach of normalising using the UI tree?
@pvillegas12 you have to call a change-route on start to start the state machines
@U0CKQ19AQ still getting the same result. The routing appears to work but I’m not getting the state I should be getting.
I’m also getting a warning Attempt to get an ASM path [:fulcro.incubator.ui-state-machines/local-storage :pending-path-segment] for a state machine that is not in Fulcro state. ASM ID: :RootRouter
Forgot the initial state for the router, now it’s updating, still have the above warning though
it’s not initial-state
, it’s change-route
that initializes the router’s state machine
I have
(defn ^:export init []
(reset! SPA (fc/new-fulcro-client
:started-callback
(fn [{:keys [reconciler] :as app}]
(dr/change-route reconciler ["dashboard-empresa"]))
I probably just need to make it so that there is some call that scans for all routers and starts their state machines
my guess is there’s a nested router that is getting somehow used before being activated
encountering a weird bug where a ref
isn’t in the env of my mutation. my call to transact!
looks about like what you’d expect (run inside of the component):
(fp/transact! this `[(forms/reset-sign-in-form {})])
my component is a top level fulcro-router
route, if that might make any difference