Fork me on GitHub
#fulcro
<
2022-01-18
>
roklenarcic14:01:32

I see that fulcro-rad repo has removed yarn.lock and added package-json.lock. What’s the reason for that?

tony.kay16:01:20

I was having trouble getting it to run tests when that NPM sabotage thing happened last week. Perhaps it would be ok to move back, but I was damn tired of having to do extra maintenance because some immature person decided he didn’t like the reality of his open-source choices.

roklenarcic19:01:58

it affected yarn differently than npm?

tony.kay21:01:17

I was grasping at straws and NPM had a easier-to-find way to filter recursive deps

roklenarcic16:01:59

Is there a way to use 2 routers in RAD? I have 2 parts on the screen each with independent routing.

tony.kay16:01:06

Yep. They are designed to compose in arbitrary ways, but the interpretation of HTML5 routing is up to you since the URL can only easily represent one path..but the d.r. ns will be happy to work.

tony.kay16:01:02

each router is a completely independent actor in the tree. So, add a defsc child that is a target of the parent router, and which has two children, each of which is a defrouter.

sheluchin20:01:43

Alrighty, so to filter a RAD report using a https://github.com/fulcrologic/fulcro-rad-demo/blob/1ba6973b2a461f2db9d75d7ab0f529432177d278/src/shared/com/example/ui.cljc#L84 you pass in, the https://github.com/fulcrologic/fulcro-rad-demo/blob/1ba6973b2a461f2db9d75d7ab0f529432177d278/src/shared/com/example/ui/invoice_forms.cljc#L75-L78 is to include a control definition even if you don't need a control, and omit the control layout if that is the case. Next, RAD attributes can omit ao/pc-input, thereby making the associated https://github.com/fulcrologic/fulcro-rad-demo/blob/1ba6973b2a461f2db9d75d7ab0f529432177d278/src/shared/com/example/model/account.cljc#L146 global, while still taking a query parameter. This took me longer to figure out than I would like to admit 😊 Just leaving this here as a reminder to myself, and maybe it will help someone in the future.

❤️ 1
tony.kay21:01:53

and if you feel like contributing to the book, that’d be great, too

sheluchin21:01:44

Will do. I'm thinking I'll throw it in 8.1. Handling Report Queries, but maybe a section for common recipes or something would also be helpful.

tony.kay21:01:18

yeah…does the book mention the control without layout? That is an intentional feature

tony.kay21:01:27

or pattern, at least

sheluchin22:01:21

I don't think it does at the moment.

sheluchin22:01:22

I ctrl+f'd my way through control and layout and didn't spot anything relevant to control without layout. Maybe it's under some other wording.

janezj22:01:13

in com.fulcrologic.fulcro.cards.nested-dynamic-routing-tree-cards I just changed on Root component initial-state from map to lambda and got several error messages,

(defsc Root [this {:root/keys [:router] :as props}]
  {:query         [{:root/router (comp/get-query RootRouter)}]
   :initial-state (fn [_] {:root/router {}})}
   ;:initial-state {:root/router {}}}
....
core.cljs:159 ERROR [com.fulcrologic.fulcro.routing.dynamic-routing:688] - You are routing to a router  :com.fulcrologic.fulcro.cards.nested-dynamic-routing-tree-cards/ARouter whose state was not composed into the app from root. Please check your :initial-state. See 
core.cljs:159 INFO [com.fulcrologic.fulcro.algorithms.indexing:103] - component com.fulcrologic.fulcro.cards.nested-dynamic-routing-tree-cards/A1's ident ([:id nil]) has a `nil` second element. This warning can be safely ignored if that is intended. Props were nil
core.cljs:159 INFO [com.fulcrologic.fulcro.algorithms.indexing:103] - component com.fulcrologic.fulcro.cards.nested-dynamic-routing-tree-cards/A's ident ([:id nil]) has a `nil` second element. This warning can be safely ignored if that is intended. Props were nil
util.cljs:136 CLJS DevTools: some custom formatters were not rendered.

browser.cljs:20 shadow-cljs: #21 ready!
react_devtools_backend.js:4045 ERROR [com.fulcrologic.fulcro.components:780] - Props passed to com.fulcrologic.fulcro.cards.nested-dynamic-routing-tree-cards/A are of the type cljs.core/PersistentVector instead of a map. Perhaps you meant to `map` the component over the props? See  
    at com.fulcrologic.fulcro.cards.nested-dynamic-routing-tree-cards/RootRouter
    at div
    at com.fulcrologic.fulcro.cards.nested-dynamic-routing-tree-cards/Root
2
react_devtools_backend.js:4045 ERROR [com.fulcrologic.fulcro.routing.dynamic-routing:167] - There is a router in state that is missing an ID. This indicates that you forgot to compose it into your initial state! It will fail to operate properly. See 
react_devtools_backend.js:4045 ERROR [com.fulcrologic.fulcro.routing.dynamic-routing:188] - dr/target-ready! was called but there was no router waiting for the target listed:  [:id "a1"] This could mean you sent one ident, and indicated ready on another. See 

tony.kay00:01:19

Yep. You didn’t do it right…lambda is LITERAL, so you composed an empty map into state. The non-lambda treats and empty map as a call to get-initial-state. See https://book.fulcrologic.com/#_step_1the_initial_state https://book.fulcrologic.com/#_initial_state_2

tony.kay00:01:30

The latter explains the difference in notation

1