lilactown / helix

A simple, easy to use library for React development in ClojureScript.
Eclipse Public License 2.0
631 stars 52 forks source link

Compile warnings using Figwheel #25

Closed jc776 closed 4 years ago

jc776 commented 4 years ago

I'm getting the following compile warnings when using Figwheel - these hook macros are defined outside a reader conditional, but depend on things only defined under :clj:

deps-macro-body is only defined for :clj:

use-effect Use of undeclared Var helix.hooks/deps-macro-body at line 156, column 4 in file helix\hooks.cljc
use-layout-effect Use of undeclared Var helix.hooks/deps-macro-body at line 176, column 4 in file helix\hooks.cljc
use-memo Use of undeclared Var helix.hooks/deps-macro-body at line 196, column 4 in file helix\hooks.cljc
use-callback Use of undeclared Var helix.hooks/deps-macro-body at line 224, column 4 in file helix\hooks.cljc
use-imperative-handle Use of undeclared Var helix.hooks/deps-macro-body at line 243, column 4 in file helix\hooks.cljc

hana is only imported under :clj:

use-memo No such namespace: hana, could not locate hana.cljs, hana.cljc, or JavaScript source providing "hana"  helix\hooks.cljc   line:203  column:16
Use of undeclared Var hana/inferred-type helix\hooks.cljc   line:203  column:16
Use of undeclared Var hana/inferred-type helix\hooks.cljc   line:209  column:16

I'm using fix-figwheel :sha "43ed17b2828ae7f5b406f99d5dbb753321bf73d6".

jc776 commented 4 years ago

I get further warnings about calls to private vars when using the macros:

[Figwheel:WARNING] Compile Warning   client.cljs   line:8  column:1

  var: helix.core/extract-cljs-props is not public

   3      [helix.core :refer [defnc $]]
   4      [helix.hooks :as hooks]
   5      [helix.dom :as d]
   6      ["react-dom" :as rdom]))
   7
   8  (defnc Greeting [{:keys [name]}]
      ^---
(defnc App []
  (let [[name set-name] (hooks/use-state "Helix User")]
    (hooks/use-effect :auto-deps
      (js/console.log "effect" name)
      (set! js/document.title name))
    (d/div
     (d/h1 "Welcome!"
      ;; create elements out of components
      ($ Greeting {:name name})
      (d/input {:value name
                :on-change #(set-name (.. % -target -value))})))))

var: helix.hooks/raw-use-effect is not public
var: helix.hooks/wrap-fx is not public
lilactown commented 4 years ago

I've updated the fix-fighweel branch that should correct those warnings.

lilactown commented 4 years ago

I've also created an example repo here: https://github.com/Lokeh/fighweel-helix