Fork me on GitHub
#fulcro
<
2018-01-14
>
eric.shao06:01:55

When using [fulcro-css.css :refer [upsert-css]], why always alert “java.lang.IllegalAccessError: upsert-css does not exist”

maridonkers09:01:34

The fulcro-css dependency is in your project.clj?https://clojars.org/fulcrologic/fulcro-css

eric.shao15:01:23

:thinking_face:Need to put [fulcrologic/fulcro-css “2.0.0”] in project.clj ? Even if I added it to the project.clj, the alert still exist.

eric.shao15:01:39

BTW, the css has been generated and changed the dom’s style correctly.

eric.shao15:01:44

But when you changed the colocated-style => then trigger the rerender => then paused by the alert. I have to re-load the clj file to let (css/upsert-css “my-css” Root) work.

edward.scott16:01:14

I am being slowly driven mad again by routing. What am I doing wrong in this example:

edward.scott16:01:46

`(defsc Screen1 [this {:keys [screen1-datum dropdown]}] {:initial-state (fn [p] {:screen1-datum 42 :dropdown (b/dropdown :dropdown-screen1 "10" [(b/dropdown-item 10 "10") (b/dropdown-item 50 "50") (b/dropdown-item 100 "100")])}) :ident (fn [] [:screen1 :singleton]) :query (fn [] [:screen1-datum {:dropdown (prim/get-query b/Dropdown)}])} (dom/div nil (dom/h1 nil "Screen 1") (b/ui-dropdown dropdown :stateful? true))) (defsc Screen2 [this {:keys [screen2-datum dropdown]}] {:initial-state (fn [p] {:screen2-datum 99 :dropdown (b/dropdown :dropdown-screen2 "A" [(b/dropdown-item :a "A") (b/dropdown-item :b "B") (b/dropdown-item :c "C")])}) :ident (fn [] [:screen2 :singleton]) :query (fn [] [:screen2-datum {:dropdown (prim/get-query b/Dropdown)}])} (dom/div nil (dom/h1 nil "Screen 2") (b/ui-dropdown dropdown :stateful? true))) (defn select-router [props] #?(:cljs(js/console.log "props" props)) (condp #(contains? %2 %1) props :screen1-datum [:screen1 :singleton] :screen2-datum [:screen2 :singleton])) (defrouter ScreenRouter :screen-router (ident [this props] (select-router props)) :screen1 Screen1 :screen2 Screen2) (def ui-screen-router (prim/factory ScreenRouter)) (defsc Root [this {:keys [screens]}] {:initial-state (fn [p] (merge (r/routing-tree (r/make-route :show-screen1 [(r/router-instruction :screen-router [:screen1 :singleton])]) (r/make-route :show-screen2 [(r/router-instruction :screen-router [:screen2 :singleton])])) {:screens (prim/get-initial-state ScreenRouter nil)})) :query (fn [] [{:screens (prim/get-query ScreenRouter)}])} (let [showScreen (fn [screen] (prim/transact! this `[(r/route-to {:handler ~screen})]))] (dom/div nil (dom/div nil (b/button {:onClick #(showScreen :show-screen1)} "Show 1") (b/button {:onClick #(showScreen :show-screen2)} "Show 2")) (ui-screen-router screens))))`

edward.scott16:01:21

The dropdown on Screen 2 does not work.

edward.scott16:01:01

If I swap Screen1 and Screen2 in the router then Screen1 is broken.

edward.scott16:01:31

The map :bootstrap.dropdown/by-id only contains :dropdown-screen1.

edward.scott16:01:44

I am using Fulcro 2.1.0

tony.kay19:01:17

@mandor2017 kind of a wide open question

tony.kay19:01:23

what is it doing you don't expect?

edward.scott19:01:15

The dropdown menu on Screen2 is showing only the caret.

tony.kay19:01:29

ah...so not routing isn't the problem.

tony.kay19:01:57

version of Fulcro?

edward.scott19:01:37

The map :bootstrap.dropdown/by-id only contains :dropdown-screen1

tony.kay19:01:12

do you see screen 2 in state at all?

edward.scott19:01:12

Yes. :screen2 :singleton looks correct.

tony.kay19:01:26

ident pointing to dropdown?

tony.kay19:01:49

rather :drowdown field has an ident in it?

edward.scott19:01:07

dropdown has [:bootstrap.dropdown/by-id :dropdown-screen2]

edward.scott19:01:22

But that is not present.

tony.kay19:01:23

ok, so that means normalization tried to put it into the table

tony.kay19:01:30

what would have stomped on it?

tony.kay19:01:02

so you see the dropdown items for that dropdown in their table?

edward.scott19:01:09

There is no loading. The example code is all there is.

tony.kay19:01:41

I'm not seeing a problem with the code 😕

edward.scott19:01:16

Items for Screen one menu only.

tony.kay19:01:30

ok, that's a clue

edward.scott19:01:51

Can you tried it to see if my setup is hosed in some fashion?

tony.kay19:01:50

I was actually headed out the door. was trying to see if I could help you spot something.

tony.kay19:01:46

here are some things to try from a REPL.

tony.kay19:01:21

well, that won't help 😕

tony.kay19:01:30

nvm. Do you see any console error messages?

edward.scott19:01:10

[9303.326s] [fulcro.client] malformed Ident. An ident must be a vector of two elements (a keyword and an EDN value). Check the Ident implementation of component fulcro.ui.bootstrap3/Dropdown. console.js:203 [9303.328s] [fulcro.client] component fulcro.ui.bootstrap3/Dropdown's ident ([nil nil]) has a nil second element. This warning can be safely ignored if that is intended. 2

tony.kay19:01:27

ok, that is the problem...now why

tony.kay19:01:18

OH...I bet this is a bug

tony.kay19:01:29

well, no, I take that back

edward.scott19:01:49

:bootstrap.dropdown/by-id get a nil entry when I try the broken dropdown.

tony.kay19:01:19

if you (get-initial-state Screen2 {})

tony.kay19:01:22

does it look right?

maridonkers19:01:02

Both screen 1 and 2 use :dropdown and Root merges screen 1 and 2?

tony.kay19:01:50

no. I was worried about the keywords possibly overlapping, but the merge is more complicated than that with unions

edward.scott19:01:52

{:screen2-datum 99, :dropdown {:fulcro.ui.bootstrap3/id :dropdown-screen2, :fulcro.ui.bootstrap3/active-item nil, :fulcro.ui.bootstrap3/label "A", :fulcro.ui.bootstrap3/items [{:fulcro.ui.bootstrap3/id :a, :fulcro.ui.bootstrap3/label "A"} {:fulcro.ui.bootstrap3/id 😛, :fulcro.ui.bootstrap3/label "B"} {:fulcro.ui.bootstrap3/id :c, :fulcro.ui.bootstrap3/label "C"}], :fulcro.ui.bootstrap3/open? false, :type :bootstrap.dropdown/by-id}}

tony.kay19:01:27

So, I do have to go...but try switching the screen order

tony.kay19:01:31

screen 2 first inthe router

tony.kay19:01:48

if that works, then it is a bug. If it doesn,t, then we're missing some minor typo or something

edward.scott19:01:59

Then the problem screen switches.

tony.kay19:01:14

yeah, that's a Fulcro bug. File an issue and I'll look at it

tony.kay19:01:38

Yes. you could also try naming :dropdown differently in one...but that should not matter.

edward.scott19:01:42

I will file a bug now. Thank you for your assistance.