Fork me on GitHub
#fulcro
<
2022-10-19
>
sheluchin14:10:37

Weird.. I got the Props passed to ... are of the type cljs.core/PersistentVector instead of a map. Perhaps you meant to map the component over the props? message when I forgot to coerce the :item/id to a uuid in :will-enter's call to route-immediate.

Adrian Aleixandre17:10:14

Just a hypothesis: Do you have initial state configured? If not, then it may be happening on the first render. Try just adding :initial-state {} to your component config

sheluchin18:10:13

Yes, initial state was configured using template mode like that. Guess that's not it :man-shrugging: but I thought the same at first because it has happened to others in the Slack history here.

Joe R. Smith15:10:22

Are there any examples of custom theming with SemanticUI and Fulcro out in the wild, e.g., on Github?

PB16:10:18

Hello. I am struggling with setup. When I follow the readme on the fulcro-rad-demo, and navigate to localhost:3000, all I get is a blank page? Is this right?

Joe R. Smith16:10:17

it should not be a blank page.

Joe R. Smith16:10:41

Did shadow-cljs successfully compile it? Are you running shadow-cljs watch?

PB16:10:19

I believe it did, however I can show you the output

PB16:10:01

the clj repl

2022-10-19T16:37:45.823Z grim INFO [com.fulcrologic.fulcro.server.config:54] - Reading configuration file at  config/defaults.edn
2022-10-19T16:37:45.825Z grim INFO [com.fulcrologic.fulcro.server.config:54] - Reading configuration file at  config/dev.edn
2022-10-19T16:37:45.826Z grim INFO [com.example.components.config:14] - Loading config config/dev.edn
I 2022-10-19T16:37:45.827Z           _rad.database-adapters.datomic:-345 - Starting database  :main
W 2022-10-19T16:37:46.024Z           _rad.database-adapters.datomic:-283 - ==========================================================
W 2022-10-19T16:37:46.025Z           _rad.database-adapters.datomic:-284 - Database mocking enabled. No database changes will persist!
W 2022-10-19T16:37:46.025Z           _rad.database-adapters.datomic:-285 - ==========================================================
I 2022-10-19T16:37:46.025Z           _rad.database-adapters.datomic:-286 - Adding form save support to database transactor functions.
I 2022-10-19T16:37:46.081Z           _rad.database-adapters.datomic:-295 - Finished connecting to and migrating database.
I 2022-10-19T16:37:46.082Z                           _rad.resolvers:- 45 - Building attribute resolver for :account/all-accounts
I 2022-10-19T16:37:46.082Z                           _rad.resolvers:- 45 - Building attribute resolver for :account/invoices
I 2022-10-19T16:37:46.083Z                           _rad.resolvers:- 45 - Building attribute resolver for :category/all-categories
I 2022-10-19T16:37:46.083Z                           _rad.resolvers:- 45 - Building attribute resolver for :item/all-items
I 2022-10-19T16:37:46.083Z                           _rad.resolvers:- 45 - Building attribute resolver for :invoice/all-invoices
I 2022-10-19T16:37:46.083Z                           _rad.resolvers:- 45 - Building attribute resolver for :invoice-statistics/date-groups
I 2022-10-19T16:37:46.084Z                           _rad.resolvers:- 45 - Building attribute resolver for :invoice-statistics/gross-sales
I 2022-10-19T16:37:46.084Z                           _rad.resolvers:- 45 - Building attribute resolver for :invoice-statistics/items-sold
I 2022-10-19T16:37:46.084Z                           _rad.resolvers:- 45 - Building attribute resolver for :line-item/category
I 2022-10-19T16:37:46.085Z           _rad.database-adapters.datomic:-385 - Building ID resolver for :account/id
I 2022-10-19T16:37:46.093Z           _rad.database-adapters.datomic:-385 - Building ID resolver for :address/id
I 2022-10-19T16:37:46.093Z           _rad.database-adapters.datomic:-385 - Building ID resolver for :category/id
I 2022-10-19T16:37:46.094Z           _rad.database-adapters.datomic:-385 - Building ID resolver for :item/id
I 2022-10-19T16:37:46.094Z           _rad.database-adapters.datomic:-385 - Building ID resolver for :invoice/id
I 2022-10-19T16:37:46.094Z           _rad.database-adapters.datomic:-385 - Building ID resolver for :line-item/id
I 2022-10-19T16:37:46.095Z           _rad.database-adapters.datomic:-385 - Building ID resolver for :file/id
I 2022-10-19T16:37:46.113Z            com.example.components.server:- 13 - Starting webserver with config  {:port 3000}
I 2022-10-19T16:37:46.115Z                              development:- 36 - SEEDING data.

PB16:10:47

cljs repl

shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.15.12 running at 
shadow-cljs - nREPL server started on port 9000
shadow-cljs - watching build :main
[:main] Configuring build.
[:main] Compiling ...
GUARDRAILS IS ENABLED. RUNTIME PERFORMANCE WILL BE AFFECTED.
Mode: :runtime  Async? false  Throw? false
Guardrails was enabled because the CLJS Compiler config enabled it
WARNING: parse-long already refers to: #'clojure.core/parse-long in namespace: com.fulcrologic.rad.type-support.integer, being replaced by: #'com.fulcrologic.rad.type-support.integer/parse-long
WARNING: abs already refers to: #'clojure.core/abs in namespace: cljc.java-time.duration, being replaced by: #'cljc.java-time.duration/abs
WARNING: parse-long already refers to: #'clojure.core/parse-long in namespace: com.fulcrologic.rad.form, being replaced by: #'com.fulcrologic.rad.form/parse-long
[:main] Build completed. (933 files, 0 compiled, 0 warnings, 6.04s)

Joe R. Smith16:10:27

That all looks fine

Joe R. Smith16:10:40

do you have errors in your browser console?

PB16:10:02

I do:

main.js:1452 ReferenceError: JSJoda is not defined
    at shadow$provide.module$node_modules$$js_joda$timezone$dist$js_joda_timezone_10_year_range_min (js-joda-timezone-10-…range.min.js:6:4096)
    at shadow.js.jsRequire (js.js:66:18)
    at shadow.js.require (js.js:113:20)
    at eval (com.fulcrologic.rad.…ar_timezone.js:2:93)
    at eval (<anonymous>)
    at goog.globalEval (main.js:486:12)
    at env.evalLoad (main.js:1560:12)
    at main.js:2198:12
main.js:1454 The above error occurred when loading "com.fulcrologic.rad.type_support.ten_year_timezone.js". Any additional errors after that one may be the result of that failure. In general your code cannot be trusted to execute properly after such a failure. Make sure to fix the first one before looking at others.
core.cljc:186 2022-10-19T16:39:35.605Z INFO [com.fulcrologic.rad.form:477] - NOTE:  com.example.ui.file-forms.FileForm  does not have a route prefix and will only be usable as a sub-form.
core.cljc:186 2022-10-19T16:39:35.696Z INFO [com.fulcrologic.rad.form:477] - NOTE:  com.example.ui.master-detail.AccountForm  does not have a route prefix and will only be usable as a sub-form.
timbre_support.cljs:80 INFO [com.example.client:51] -  Starting App
shadow.module.main.append.js:4 An error occurred when calling (com.example.client/init)
main.js:1452 
JsJodaException {message: 'unsupported ZoneId:America/Los_Angeles', stack: 'DateTimeException: unsupported ZoneId:America/Los_…le.main.append.js:4:26)\n    at eval (<anonymous>)', toString: ƒ}
main.js:1454 The above error occurred when loading "shadow.module.main.append.js". Any additional errors after that one may be the result of that failure. In general your code cannot be trusted to execute properly after such a failure. Make sure to fix the first one before looking at others.
util.cljs:136 CLJS DevTools: some custom formatters were not rendered.

browser.cljs:20 shadow-cljs: #5 ready!

Joe R. Smith16:10:45

did you use yarn or npm?

PB16:10:51

I used yarn

Joe R. Smith16:10:13

the yarn.lock contains the correct deps to avoid that error, did you delete it?

Joe R. Smith16:10:28

(the yarn.lock that is part of the demo repo)

PB16:10:40

I don't believe so, but I can reset

Joe R. Smith16:10:25

I ran into this exact issue in my fulcro rad project and that's how I got around it. I haven't taken the time to really dig into it though, so I can't be much more help with it.

PB16:10:43

Oh, yes. That was the issue. Thank you

Joe R. Smith16:10:03

awesome! no problem

PB16:10:19

One more question. I believe this has login functionality?

Joe R. Smith16:10:46

It does, but I don't think it's really "production ready".

PB16:10:53

Oh yes, I know that

PB16:10:05

I was wondering if you happened to know the user/pass?

Joe R. Smith16:10:18

oh, yes- I think it is prefilled, is it not?

Joe R. Smith16:10:36

from the readme: Login is with password letmein.

PB16:10:37

Mine isn't but I'll figure it out

PB16:10:38

Thank you

keeth12:10:39

huh, seeing the same error here. either installing deps via yarn or npm install i get the JSJoda is not defined error

keeth12:10:28

ok i fixed it by adding a preload before fulcro.inspect.preload:

:preloads   [com.example.preload com.fulcrologic.fulcro.inspect.preload]
com/example/preload.cljs:
(ns com.example.preload
  (:require
    ["./globalJoda"]))
com/example/globalJoda.js:
global.JSJoda = require('@js-joda/core');
kinda hacky but works 🙃.. i'm sure there's a better way.

Adrian Aleixandre17:10:56

Hey all, is there a way to run some code on route-change for an entire router? I want to transact a mutation whenever someone switches between routes but don't want to have to call the function in the :will-enter for every single route. Is there a way to accomplish this?

sheluchin15:10:40

I guess you could create your own defsc-like macro which copies the original but just sets :will-enter to whatever you like as in RAD's https://github.com/fulcrologic/fulcro-rad/blob/develop/src/main/com/fulcrologic/rad/container.cljc#L171. Might be nice to have the ability to change the defrouter's state machine using a similar mechanism as fo/machine and ro/machine so you could overwrite parts of the https://github.com/fulcrologic/fulcro/blob/55cd2d4b2a2f60e9d829ec19c2035f19cdfb8588/src/main/com/fulcrologic/fulcro/routing/dynamic_routing.cljc#L381 with your own logic more easily. But I'm curious if there's a prescribed method already available.