Fork me on GitHub

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

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]
Any ideas what I’m doing wrong?


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?


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


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


A lein clean is always a good first step though.


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


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


Think I need to learn more about clojure first


@U2RGGEK17 did you check out the video series ?


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


Just released version 2.2.1, which includes some improvements to UI routing, and the dev guide section about it 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).


@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?


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


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


or completely opaque


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


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


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


@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.


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


that will prevent normalization


@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.


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