Fork me on GitHub
#fulcro
<
2018-02-25
>
okeydoke03:02:30

Hey guys I’ve been working my way through the fulcro book but having issues running some of the examples in the REPL. I’m pretty new to Clojure(script) so not really sure about REPL but this is the kinda error I’m getting

STARTING FIGWHEEL ON BUILDS:  (dev)
Figwheel: Starting server at 
Figwheel: Watching build - dev
Compiling "resources/public/js/okeydoke.js" from ["src/dev" "src/main"]...
Failed to compile "resources/public/js/okeydoke.js" in 45.026 seconds.
----  Could not Analyze  src/main/okeydoke/api/mutations.cljs  ----

  No such namespace: app.ui.root, could not locate app/ui/root.cljs, app/ui/root.cljc, or JavaScript source providing "app.ui.root" 

----  Analysis Error : Please see src/main/okeydoke/api/mutations.cljs  ----
Figwheel: Starting CSS Watcher for paths  ["resources/public/css"]
Launching ClojureScript REPL for build: dev
Figwheel Controls:
          (stop-autobuild)                ;; stops Figwheel autobuilder
          (start-autobuild [id ...])      ;; starts autobuilder focused on optional ids
          (switch-to-build id ...)        ;; switches autobuilder to different build
          (reset-autobuild)               ;; stops, cleans, and starts autobuilder
          (reload-config)                 ;; reloads build config and resets autobuild
          (build-once [id ...])           ;; builds source one time
          (clean-builds [id ..])          ;; deletes compiled cljs target files
          (print-config [id ...])         ;; prints out build configurations
          (fig-status)                    ;; displays current state of system
          (figwheel.client/set-autoload false)    ;; will turn autoloading off
          (figwheel.client/set-repl-pprint false) ;; will turn pretty printing off
  Switch REPL build focus:
          :cljs/quit                      ;; allows you to switch REPL to another build
    Docs: (doc function-name-here)
    Exit: Control+C or :cljs/quit
 Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application
To quit, type: :cljs/quit
dev:cljs.user=> (go)
----  Compiler Warning on   cljs form   line:1  column:2  ----

  Use of undeclared Var cljs.user/go

  1  (go)
      ^--- 

----  Compiler Warning  ----
#object[TypeError TypeError: Cannot read property 'call' of undefined]
nil
dev:cljs.user=> 
Any ideas what I’m doing wrong?

cjmurphy03:02:48

Do you have a directory src/main/app/ui off the project root, that has a file in it called root.cljs, or root.clc? At the top of that file is the ns app.ui.root?

okeydoke05:02:50

nah its actually src/main/okeydoke/ui and at the top of the file is ns okeydoke.ui.root. I think I created it using the lein command

cjmurphy05:02:03

So try and rename everything that says okeydoke to app. That should get rid of the errors.

cjmurphy05:02:28

A lein clean is always a good first step though.

cjmurphy05:02:48

Also look at where app is still being mentioned in your project.clj file.

okeydoke08:02:23

thanks for the help, I deleted my folder and started a new project with lein new fulcro my-project but still not having any luck. I’ll keep working though the book and see if theres something I’m missing

okeydoke08:02:55

Think I need to learn more about clojure first

claudiu08:02:28

@U2RGGEK17 did you check out the video series ?

okeydoke02:02:58

Ahh nah I haven't yet. I watched one of the older videos Tony did when it was untangled but haven't watched newer ones. At the moment I think it's probably a bit much trying to jump in and learn fulcro without very much clojure experience. Setting up environments and and understand REPLs and stuff is a bit confusing

tony.kay07:02:56

Just released version 2.2.1, which includes some improvements to UI routing, and the dev guide section about it http://book.fulcrologic.com/#BasicRouter The improvements are backward compatible (the new support allows you to use fn instead of ident for the ident part of the defrouter, but that is just to improve IDE recognition. Technically it doesn’t care what symbol you use there now).

donmullen21:02:15

@tony.kay Still playing around with dx-react-grid. I’d like to be able to query the server for a list of items - and then target a node in the graph w/o any normalization. Not quite how to accomplish that, as it’s not the normal fulcro model. This is read-only data that I want to plop into a grid control. I could do a post-mutation but then I have data in the graph that’s likely not used. I could do the query / modify the state-map out-of-band. Thoughts?

tony.kay21:02:45

@donmullen not a problem..just don’t add a component/query/ident for that edge 🙂

tony.kay21:02:00

You are allowed to keep any part of the app state you want denormalized.

tony.kay21:02:05

or completely opaque

tony.kay21:02:28

e.g. a query for [:x] can return a vector of maps.

tony.kay21:02:09

So, if you (load :root/list-of-things nil) and the server returns a vector of maps, then you’ll have that vector of maps at that root key

tony.kay21:02:22

Target that to a field on any entity, and you’re done

donmullen22:02:18

@tony.kay - ah - thanks. I was using a component so that I’d have a query - but in this case I would pass nil or component, and perhaps pass the query in params.

tony.kay22:02:09

You can also have a component with a query, and skip the ident

tony.kay22:02:16

that will prevent normalization

donmullen22:02:08

@tony.kay - ok thanks. So this worked (used a component with no ident): (df/load app :pluto-properties PropertyItems {:target [:root-properties]}) but this new target: (df/load app :pluto-properties PropertyItems {:target [:root-grid :grid-demo/grid :grid/rows]}) got error: Mutation fulcro/load failed with exception Error: Vector's key for assoc must be a number.

tony.kay22:02:04

target uses assoc-in, so chances are your target was a vector and it wanted an index