Fork me on GitHub
#fulcro
<
2021-09-17
>
Björn Ebbinghaus10:09:00

Is there a preferred way to use forwardRef with fulcro components? Until now I always write:

(def flip-move-item
  (js/React.forwardRef
    (fn [props ref]
      (grid/item {:xs 12 :md 6 :lg 4 :style {:flexGrow 1} :ref ref}
        (.-children props)))))

(def ui-flip-move-item (interop/react-factory flip-move-item))

tony.kay23:09:46

I don't have one, because to date I have not personally needed it. Seems like we could probably turn that pattern into a factory helper

tony.kay23:09:15

or perhaps augment the curernt factory to auto-support :forwardRef as a simple option

tony.kay23:09:22

well, that's mainly for a Fulcro component, though...I guess something in the react ns as a helper might be the answer for this simpler case

damien19:09:59

Hi all - I am trying to set up the proper clj-kondo lints for a fulcro RAD project, but am getting ~ 100 unresolved symbol errors. I can't seem to get the linters to understand the fulcro macros etc even though I've run https://github.com/clj-kondo/config and used the suggested fulcro setup. Is there a trick to getting this working?

borkdude19:09:46

@damienstanton with the newest fulcro you shouldn't be needing that anymore. just lint the fulcro dependency with --copy-configs enabled and there will be a config copied to your .clj-kondo directory if you have one.

borkdude19:09:19

if you are using clojure-lsp (e.g. via Calva) this will happen automatically. the only thing you should then do is set the right :config-paths to include the config

damien19:09:22

Got it, yeah this is setting up a new instance of the RAD demo repo (https://github.com/fulcrologic/fulcro-rad-demo) using Calva/clojure-lsp

borkdude19:09:15

cool, let me try that to see if this works

borkdude19:09:36

oh I see that isn't using the newest fulcro yet

Jakub Holý (HolyJak)20:09:36

thanks for helping here, @borkdude! @damienstanton simply add dependency on the latest Fulcro .

👍 2
damien20:09:59

Hmm, so updating and rebuild did indeed automatically set --copy-configs as you suggested @borkdude, however clj-kondo still reports 402 unresolved symbol errors on a fresh clone.

sheluchin16:09:15

I've upgraded to the latest Fulcro, rebuilt, confirmed the .clj-kondo/com.fulcrologic/fulcro/ folder exists, and set config-paths:

:config-paths ["configs/mount"
                "com.fulcrologic/fulcro"]}
But I'm still getting a bunch of warnings like this:
------ WARNING #39 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:103:16
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

borkdude16:09:46

This warning isn't coming from the linter

borkdude16:09:50

but probably from shadow?

sheluchin18:09:25

@borkdude I went and upgraded a bunch of my deps. I've isolated those particular warnings to upgrading hashp 0.2.0 -> 0.2.1. Upon upgrading:

[:main] Build completed. (355 files, 45 compiled, 39 warnings, 24.85s)

------ WARNING #1 - :undeclared-var --------------------------------------------
 Resource: sci/impl/fns.cljc:141:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #2 - :undeclared-var --------------------------------------------
 Resource: sci/impl/fns.cljc:142:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #3 - :undeclared-var --------------------------------------------
 Resource: sci/impl/fns.cljc:145:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #4 - :undeclared-var --------------------------------------------
 Resource: sci/impl/fns.cljc:146:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #5 - :undeclared-var --------------------------------------------
 Resource: sci/impl/fns.cljc:149:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #6 - :undeclared-var --------------------------------------------
 Resource: sci/impl/fns.cljc:150:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #7 - :undeclared-var --------------------------------------------
 Resource: sci/impl/fns.cljc:153:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #8 - :undeclared-var --------------------------------------------
 Resource: sci/impl/fns.cljc:154:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #9 - :undeclared-var --------------------------------------------
 Resource: sci/impl/fns.cljc:157:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #10 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:158:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #11 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:161:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #12 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:162:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #13 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:165:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #14 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:166:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #15 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:169:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #16 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:170:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #17 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:173:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #18 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:174:28
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #19 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:177:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #20 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:178:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #21 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:181:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #22 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:182:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #23 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:185:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #24 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:186:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #25 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:189:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #26 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:190:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #27 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:193:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #28 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:194:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #29 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:197:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #30 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:198:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #31 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:201:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #32 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:202:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #33 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:205:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #34 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:206:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #35 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:209:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #36 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:210:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #37 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:213:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #38 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:214:29
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------

------ WARNING #39 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:103:16
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------
And downgrading gets rid of those completely. Not sure if this is of any interest to you, but there it is :man-shrugging: Thanks for helping me narrow it down, or at least eliminate clj-kondo as the culprit here.

borkdude20:09:42

@damienstanton > the only thing you should then do is set the right `:config-paths` to include the config

damien20:09:53

Let me make sure I didn't miss that

borkdude20:09:06

there should be a folder inside your .clj-kondo now with config

borkdude20:09:17

you should add that to :config-paths

damien20:09:45

Many thanks both! - I think this set me on the right path. The unresolved errors are now down to 76.

Jakub Holý (HolyJak)21:09:06

it is likely the config can be improved still - PRs appreciated :)

sheluchin16:09:15

I've upgraded to the latest Fulcro, rebuilt, confirmed the .clj-kondo/com.fulcrologic/fulcro/ folder exists, and set config-paths:

:config-paths ["configs/mount"
                "com.fulcrologic/fulcro"]}
But I'm still getting a bunch of warnings like this:
------ WARNING #39 - :undeclared-var -------------------------------------------
 Resource: sci/impl/fns.cljc:103:16
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------