This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-28
Channels
- # announcements (11)
- # aws (30)
- # beginners (98)
- # calva (11)
- # cider (42)
- # clj-kondo (4)
- # cljdoc (1)
- # cljsrn (5)
- # clojure (132)
- # clojure-europe (4)
- # clojure-ireland (1)
- # clojure-italy (35)
- # clojure-japan (2)
- # clojure-nl (5)
- # clojure-spec (5)
- # clojure-uk (24)
- # clojurescript (71)
- # clojutre (1)
- # core-async (6)
- # cursive (9)
- # data-science (4)
- # datascript (3)
- # datomic (78)
- # duct (16)
- # emacs (14)
- # events (2)
- # fulcro (141)
- # graalvm (5)
- # hoplon (14)
- # hyperfiddle (2)
- # jobs-discuss (14)
- # joker (8)
- # luminus (2)
- # off-topic (7)
- # om (1)
- # pathom (4)
- # pedestal (7)
- # planck (2)
- # quil (1)
- # re-frame (14)
- # reagent (2)
- # reitit (14)
- # robots (1)
- # shadow-cljs (20)
- # spacemacs (25)
- # specter (1)
- # sql (122)
- # tools-deps (63)
- # unrepl (2)
- # yada (34)
ok i don't get it. i tried and tried but there is no way i could find to put the data of a component directly in the root of the database. I can fake it with a [:my-component :singleton]
ident, but that's cheating. The examples i've been looking at in the book don't seem to translate, must be a version thing.
i tried with the [my-component '_]
query, but then the data stays in ui/root, unless i define an ident, in which case it goes in a my-component table at key _
that's not very important but i feel there is something i didn't understand and that bugs me to no end
i can read data from root, but it looks like fulcro won't help me create data at the root ?
your queries deal with how to get the data, Fulcro helps via df/load
to populate your DB
(ns app.ui.root
(:require
[fulcro.client.dom :as dom :refer [div]]
[fulcro.client.primitives :as prim :refer [defsc]]
[app.ui.components :as comp]))
(defsc Root [this {:keys [root/message]}]
{:query [:root/message]
:initial-state {:root/message "Hello!"}}
(div :.ui.segments
(div :.ui.top.attached.segment
(div :.content
"Welcome to Fulcro!"))
(div :.ui.attached.segment
(div :.content
(comp/ui-placeholder {:w 50 :h 50})
(div message)
(div "Some content here would be nice.")))))
this is an example from http://book.fulcrologic.com/
but I guarantee that (prim/get-initial-state Root)
will have a {:root/message "Hello!"}
in it
the get-initial-state call indeed gives the result you say, but that doesn't get me closer to having :root/message at the root of my database =(
@carkh did the code that @thenonameguy gave not give the desired result?
> well here is see this in the database -> ui/root ->root/message
do you have an ident on the Root
component?
this is the logic: https://github.com/nubank/workspaces/blob/master/src/nubank/workspaces/lib/fulcro_portal.cljs#L41
@hmaurer right, my root component will end up in :ui/root ... but how about a sub-component ? is it possible to tell it to act from the root, not from a "table"
in the example i gave earlier, (when i fix it up to be working) i can access the ui/locale from root
i worry that i might understand it better when i'm waist deep in the project and then have to refactor the whole thing
@hmaurer not a problem, i take this key as an example of what i want to achieve, and noted that i can query for it,
the question is ... is it ok to have this level of indirection (every singleton component in it's own table) or will i come to regret that
This would be an example of something that works, but with an indirection to get to the counter data
I can’t answer that question from experience, I would say it’s case-by-case. It’s absolutely fine to have singleton components if you want to associate them to data loaded in the DB
my rule of thumb is: let everything have a query+ident+initial-state, avoid root props unless you have a good reason to use them
that's what i've been doing, not out of a decided upon rule, but rather because i couldn't find any other way to do it =)
Hi Tony, I hate to wake you up from your fulcro 3 stupor, but we have strange issue with routing. We have our routable routes, and our root rout that declares them, and then we had a list of 8 routes, but then a particular route ( lets call it A ) stopped working. when we comment out / remove a route ( pick one, any one besides A ) then route A works again .. truely bizzarro
A total shot in the dark, but I have had “bizzarro” issues like this before with shadow-cljs build caching. Busting the cache and re-building the app fixed it for me.
i will give that a shot .. and i know what you mean
oh well .. that not work, but was good idea
@U0CKQ19AQ looks like an issue with lazyness. When adding the 9th route target it breaks the loading of data of other routes. If we remove any one route of those 9 it works again. So 8 to 9 route targets is the problem.
can you explain what you mean by "forcing the data structure with vec" ? me curious
But what I mean in general is: (map identity [1 2 3])
results in a LazySeq…whereas (mapv …)
results in a vector…using vec
on a lazy seq gives you a vector, not a lazy seq
In our
{:router-targets [CompanyDashboard CompanyDetails
Login Signup Config
PurchaseDashboard
InvoiceDashboard PosDetails]}
Adding one route above 8 breaks the other ones. I am seeing in fulcro inspecto that there are :alt0
to :alt7
only (8) which is an issue?like maps: they are arrays internally when they have less than 10 k/v pairs (I think that’s the cutoff)
The routes that fail are of the form /company/uuid/entities
. The failure is that the route that is loaded is /company/uuid
instead of /company/uuid/entities
. Adding a ninth route makes it so that the state machine resolves to the prefix and not the full route for some reason
The state machine is not transitioning correctly
I’ve changed it to various incantations with no change
No prefix, like aaa
it’s weird it breaks when adding a 9th, even if it is a static route target with nothing in it
this is the logic in question I think: https://github.com/fulcrologic/fulcro-incubator/blob/develop/src/main/fulcro/incubator/dynamic_routing.cljc#L175
might be the right code that is failing .. i wonder if we could run fulcro incubator in development mode so we could debug this locally ourselves? or is this one something you can test easily .. or do you need more info on our route structure ?
in IntelliJ that’ll just pull it in, and you can add spies and such to the logic and see what is going wrong
sure thing, thanks tony
@hmaurer we are using fulcro.incubator.dynamic-routing
ok .. no problem .. thanks for asking though
I know this probably varies from setup to setup. But are there generally tips for making the hot reload faster for Fulcro apps? My styles are instant, but when changing a cljs file I’m waiting somewhere between 15-30 seconds for a refresh.
jezz, that's a lot of time, do you have any warnings on your project? and are you using shadow or figwheel?
for perspective, I daily work in a huge fulcro project, and our refresh times usually go from 2s in avg to 10s in the worst cases (when changing files that have a lot of dependants), using shadow
No warnings, I’m using figwheel - this project used to be an untangled project and I migrated to fulcro about 6 months ago
Using shadow-cljs, react-native and web targets, using a real phone, my feedback loop takes about ~5 second from change on code and see on phone screen
if you can try shadow, I would love to hear how it compares in your current setup
@U066U8JQJ I assume that would be a large undertaking to switch from fighweel to shadow?
@njj shouldn’t that large
i migrated a largish project from boot-cljs to figwheel and it didn’t require much (if any) source code changes
just build config stuff
which can be a time sink if you’re not familiar with the build tool
but it’s not going to be anything like going from untangled to fulcro
FWIW shadow did feel faster for me when i switched to it, but i don’t have hard numbers
regardless there are somethings you can do that will help speed up compile times on both
avoid making huge utility/helper namespaces that are required all over the place
for example we have one util.clj file that is used everywhere, and touching that is the slowest re-compile
so we pulled various functions out of that into lib/datetime
lib/math
lib/counters
etc
another trick that could work is pulling parts of your code out into separate libraries
the trick is basically to reduce the number of files your tool will have to re-compile (i.e. the file you touched and all the files that required it)
you’re styles are instant most likely because you have way less CSS files/code than cljs
well that and the fact that cljs compile is much more involved that SCSS or CSS 😅
I guess the major different is how you handle the js libraries, most of then can just be converted to use strait from NPM, other than that it should be strait forward
@U066U8JQJ but even that is optional no?
shadow-cljs can handle whatever figwheel is doing, cljsjs probably
nope, clsjsjs doesn't work with shadow at all
oh i didn’t realize, looks like it used to work
i haven’t used cljsjs in a while
@njj sounds like we should add cloud compilation support 😬 Compile your CLJS on some massive server on AWS (assuming shadow can make use of many cores), and send the result back to you
sounds like it very much limit what you could get out of your build tool
for example i have a macro that uses fulcro.server/load-config
in clojure while compiling a node script
How much hurt can I expect starting a new front end with Fulcro 3? I'd like to use Workspaces as part of the development and see that they're not yet supported. Is this likely require a "rename some stuff" pass or something more involved to get support for Workspaces and inspect?
yeah, I’m an old-hat Java guy…when I started in Clj it seemed the community here wasn’t doing that, so I wanted to “fit in”…but they are just a general good idea
so, when I wanted “safe new names”, going to those seemed better than fulcro3.client...