Fork me on GitHub
#fulcro
<
2018-04-06
>
wilkerlucio00:04:59

@tony.kay question, I'm using the mutation query feature, but one thing is tricking me, I set the component to be used on the return, but I have situations of success and failure (mutation might fail by bad data, internal network error, etc...), the success case works very fine, but on the error case it seems like the integrate ident is failing

wilkerlucio00:04:33

when there is the error, I don't have the ident value (it gets nil, because the response map contains only the error), that ident with nil value is correctly added to the database

wilkerlucio00:04:40

but the reference is not placed where it should be

wilkerlucio00:04:05

so, the failed ref looks like [:some-return-ident nil], but it's assigned as just nil on the target

wilkerlucio00:04:20

is this behaviour expected?

tony.kay00:04:09

The expectation is exactly what the demo shows in the book.

tony.kay00:04:15

I don’t remember what’s there, to be honest

wilkerlucio00:04:40

I'm just trying to clarify before I jump in on debug, just hoping you might have an idea solution 🙂

tony.kay00:04:06

returning hooks up a merge for that shape of data. If something causes you to not get that data, then there isn’t much to merge 🙂

wilkerlucio00:04:26

the query of my component contains the error fields in question

wilkerlucio00:04:38

and this is been correctly read and assigned to DB

tony.kay00:04:41

but it has to contain the ID, or it cannot normalize

wilkerlucio00:04:43

just the ref is not

wilkerlucio00:04:56

can't it just normalize as [:bla nil]?

wilkerlucio00:04:09

I don't understand why the nil is not a valid thing here

wilkerlucio00:04:14

it is everywhere else

tony.kay00:04:30

oh, you’re saying that the integration of the ident is failing, but the normalization is otherwise fine?

tony.kay00:04:41

not sure why that would be

wilkerlucio00:04:57

can be a bug, just trying to clarify if there is a reasoning behind it

grant02:04:22

Has anybody else gotten this warning when they run the lein template generated project with shadow-cljs?

------ WARNING #1 --------------------------------------------------------------
 File: fulcro/client/dom.cljs:66:1
--------------------------------------------------------------------------------
  63 |               (real-factory p)))
  64 |           (apply real-factory props children))))))
  65 | 
  66 | (dom/gen-react-dom-fns)
-------^------------------------------------------------------------------------
 Use of undeclared Var fulcro.util/force-children
--------------------------------------------------------------------------------
  67 | 
  68 | (defn render
  69 |   "Equivalent to React.render"
  70 |   [component el]
--------------------------------------------------------------------------------

grant02:04:43

It only seems to happen the first time you run npx shadow-cljs watch main cards test.

cjmurphy11:04:56

Circular dependency detected fulcro_css.core -> fulcro.client.primitives -> fulcro_css.css -> fulcro.client.primitives

cjmurphy11:04:14

This is with "2.5.0-alpha4", back to alpha1 inclusive.

mitchelkuijpers11:04:09

@cjmurphy I had this when I accidentatlly included fulcro-css somewhere

cjmurphy12:04:07

Thanks @mitchelkuijpers I don't have that. In fact just putting Fulcro into this project for the first time. Only thing I can think of that may be dragging in Fulcro CSS is Fulcro Inspect. (And only a slight chance there as tools normally don't dictate dependencies - mark everything as provided - and when I last looked that was pretty much the case with Fulcro Inspect - hmm - but maybe it needs/likes to use the latest CSS stuff when the tool pops up, no matter what old Fulcro CSS you are using).

mitchelkuijpers12:04:52

@cjmurphy fulcro-inspect definately dragges it in.. are you using leiningen?

cjmurphy12:04:20

Yes using lein.

mitchelkuijpers12:04:01

if you add this to your defproject

:exclusions [fulcrologic/fulcro-css]

mitchelkuijpers12:04:10

this will exlude it everywhere

cjmurphy12:04:51

Does doing that have a cost? I want to be using the latest css stuff.

mitchelkuijpers12:04:14

No it doesn't because it has been added to fulcro

mitchelkuijpers12:04:49

It has been added since 2.4.0: IMPORTANT CHANGE: Integrated Fulcro CSS. You should remove fulcrologic/fulcro-css from your dependencies, and exclude it from any libraries that bring it in.

cjmurphy12:04:19

Right, so excludes where it is used a dependency by other libraries.

mitchelkuijpers12:04:21

Yes it will just add the exclude to every dep because you never want to drag in fulcro-css

cjmurphy12:04:31

Thanks @mitchelkuijpers Nice trick to know about, and I'm now past those circular deps errors.

roklenarcic12:04:42

I thought lein new fulcro myapp made a new fulcro project with phantom-clj

wilkerlucio13:04:47

@cjmurphy @mitchelkuijpers the yesterday release of fulcro-inspect bumped fulcro and removed the fulcro-css dep, so you can just bump that and it should work

👍 12
grant14:04:59

Using fulcro.client.alpha.dom, what is the recommended way to put two or more classes on a div? Something like (dom/div :.red :.shadowed "I have two classes") generates a clojure.spec error.

wilkerlucio14:04:00

@grant you need to "glue" then, as: (dom/div :.red.shadowed "I have tow classes")

grant14:04:44

Ah, ok, cool. So :.red.shadowed would be equivalent to class="red shadowed"?

grant14:04:58

And if you want to give something both a class and an id, you just have to put the id in the passed map? (dom/div :.class {:id "my-id"} "content") instead of something like (dom/div :.class :#my-id "content")?

troglotit14:04:06

you’d do it like this (dom/div :#id.class "content")

troglotit14:04:32

Is there already some kind of macro to consume React components just like new fulcro.client.alpha.dom? without converting to js, nils, etc?

grant15:04:42

Ah, cool. @wilkerlucio, @troglotit, thanks for the help.

tony.kay16:04:05

Version of Fulcro?

tony.kay16:04:13

if you’re using 2.5+, you don’t need the conversion

tony.kay16:04:26

just {:type "submit"}

cjmurphy16:04:31

The latest, yes 2.5+

tony.kay16:04:34

and AFTER the keyword

tony.kay16:04:41

the keyword for classes must come first

tony.kay16:04:12

spec is: (tag [kw] [props] [children]) (where brackets indicate optional, but order is required)

tony.kay16:04:35

you never need the #js or clj->js anymore

cjmurphy16:04:19

Yes good, and that works, in that no longer fails spec.

tony.kay16:04:29

though technically (div nil (p nil "hello")) or (div {} (p {} "hello") may be slightly faster at runtime than (dom (p "hello")) because the latter forces props detection at runtime instead of compile time

tony.kay17:04:14

Fulcro 2.5.0-beta1 is on clojars. I’ve also updated the lein template to generate correct projects (I hope…did lots of testing).

🚀 8
tony.kay17:04:59

The Getting Started chapter was split out to a repo, as was the tutorial. Lots of doc changes. PLEASE tell me if you see anything hosed. This is a lot of stuff to update for this change.

tony.kay17:04:11

website links, etc.

tony.kay17:04:31

I’m pushing a new version of the book in a moment

tony.kay17:04:56

New version of Developers Guide is live.

tony.kay17:04:02

New lein template is live

tony.kay17:04:53

NOTE: Fulcro itself has moved to Clojure 1.9. If anyone is still using 1.8 and sees an issue, let me know.