This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (9)
- # babashka (5)
- # babashka-sci-dev (23)
- # beginners (160)
- # calva (78)
- # cider (23)
- # clj-commons (2)
- # clj-kondo (5)
- # cljdoc (19)
- # cljs-dev (8)
- # clojure (54)
- # clojure-australia (1)
- # clojure-czech (2)
- # clojure-dev (17)
- # clojure-europe (8)
- # clojure-italy (8)
- # clojure-nl (2)
- # clojure-sg (3)
- # clojure-uk (4)
- # clojurescript (70)
- # community-development (8)
- # core-async (8)
- # cursive (7)
- # datahike (12)
- # datalog (22)
- # datomic (20)
- # events (1)
- # fulcro (43)
- # graalvm (92)
- # gratitude (5)
- # holy-lambda (77)
- # honeysql (1)
- # jobs (1)
- # lsp (111)
- # membrane (70)
- # nextjournal (13)
- # off-topic (73)
- # pathom (1)
- # polylith (8)
- # portal (32)
- # re-frame (3)
- # reagent (4)
- # reitit (5)
- # releases (2)
- # reveal (4)
- # xtdb (22)
Does anyone know of any fulcro rad templates that are in the public domain? I'd love to start a new closed-source work project from a template if possible.
I thought the MIT License meant that anyone would be able to share the code - i.e. other developer employees could legally share the codebase with competitors if they wanted. I could be way off here, all of these licenses confuse me.
Yup, MIT is “do what you want with it, just reference me and don’t blame me for anything”. It is not a share-alike like the EPL
https://github.com/realgenekim/rss-reader-fulcro-demo/tree/gene-stories Here's an RSS reader I built on top of the Fulcro RAD demo. There's a link to it running in Google Cloud Run, too.
I am using Fulcro Template to learn Fulcro. I am attempting to change email on the client side in the
defmutation. The data I am attempting to change is buried, see attached image, it is at #3. Are there helpers to easily access and update the
perhaps I'm mis-understanding your question/confusion. It's a normalized db...perhaps you're thinking you have to follow the path in the db for some reason?
Several things: 1. You should be using fulcro-inspect to view the current state. 2. Your code is clearly wrong from this screen shot. Not sure what you're doing, but you're clearly not following the basic directions for query/ident/initial state.
Thank you @U0CKQ19AQ, my previous example is modification of
Fulcro Template, so below is the vanilla
Fulcro Template client db: I am trying to update the
[:component/id :session :account/name] variable. So, I should be able to do something like:
(get-in @state [:component/id :session :account/name]) , or am I confusing everything?
That looks better. Yes, you can change it in the mutation with
(swap! state assoc-in [:component/id :session :account/name] "new name")
If you were doing (2) correctly then you would not need a helper. It's (half of) the entire point of Fulcro 🙂
Fulcro RAD 1.0.30 released. This version reverts the changes in 1.0.29. The js-joda upgrade breaks things in downstream usage. I know how to fix it and shrink the overall deployment size, but it's not work I have time for right now. I'll add it to a "good for beginning contributors" issue on github.
NOTE: 1.0.30 also includes a hot code reload improvement for faster dev in large projects. Re-evaluating a
defattr will now cause it to refresh, even if you closed over the value of it somewhere. This is roughly equivalent to using mutable data for attributes, but in the case of a defattr (which never reloads at runtime) it is only a dev-time convenience, and is not meant to be a production-time feature. To that end I will probably add some kind of flag for disabling it altogether in production builds.
Not sure if you're familiar with https://github.com/juxt/tick but it might be of interest to you on this issue: https://host-22a9c.web.app/#_optional_timezone_locale_data_for_reducing_build_size
I'm trying like hell to get rid of tick in my app. It does not work well for me, and is part of the reason I'm in this locale-hell....I actually just hand-coded the solution to that issue, and it is MUCH better.
tick uses cljc.java-time, which is just a thin wrapper over js-joda...and js-joda is excellent except for the locale and formatting stuff...code bloat and package.json hell.
I prefer using cljc.java-time directly. Matches the Java API, which means very easy to find answers on Stack Overflow, well-defined API, etc. etc. Tick is trying to be too clever IMO. You never know what the heck you have, and that leads to a lot of bugs.
Thanks for the background. I just wanted to put it on your radar in case it offered a bit of a shortcut. I haven't used it myself, but I'll trust your advice and stick to java-time instead of reaching for wrappers.
I want to like it, and I'm sure it works for some people just fine. But I've seen it used and yanked from two major projects at this point.
So fulcro backend returns
js/Date values via transit (or rather transit decodes it to js Date)…. and we have cljc.java-time… is there some way to convert values automatically to cljc.java-time values? I have tried to find function that converts
js/Date to cljc.java-time Instant and haven’t found any
So, I highly recommend that you keep your data types identical between front/back end. Transit, as you saw, uses standard js dates and jvm dates. I always leave those in that form. It's also why I added Big.js and the math ns so I could get equivalent support for bigdecimal on the front-end.
The functions in
date-time are meant to help you do common tasks with js Dates related to front-end work. I would not put cljc.java-time js Instant in your state, because then you're going to have to add a transit handler for it. You can, of course, do that, but then ALL of your database queries etc are going to have to translate things around. If you want to hack transit and change the encoding of date on the back end to Instant on the front you can do it (I think...don't know about overrides), but I think you're just going to end up confusing yourself.
Keep the data model simple and isomorphic front-to-back...If you ahve to do some temporary thing (display a date in a locale/time zone aware fashion) then use UI adapters for that...don't munge the data on the wire.
I notice that RAD demo repo doesn't have issues enabled. Is that intentional? I wanted to create an issue noting that Crux needs to be upgraded to xtdb there since they rebranded and it might be confusing for new users. There's a bit of refactoring required beyond just find/replace, but not too much.
hey, I made that crux integration and I'll push the upgrade shortly 🙂 sorry and thanks for the reminder
@UHA0AQZ2M No sir, thank you! Your integration was very helpful. I followed your initial PR in setting up Crux in my own Fulcro project.
here's the PR: https://github.com/fulcrologic/fulcro-rad-demo/pull/30 🙌
I'm not maintaining the alternate db support for the demo. If you see a problem and want to fix it, test it heavily, and send a PR that's fine. Too much to do.
Thanks. I'm guessing it'll take me a few weeks of tinkering to get more comfortable with RAD. I liked what I read in the intro.
is it generally considered bad practice to call
m/set-value! inside a mutation definition?
(Should one strive to directly modify the state-map if possible, or does the transaction system somehow know when its called inside a mutation and do the right thing?)
The docstring suggests you should only use it for UI-related data. That doesn't directly answer your question, but perhaps it helps. In the few places I'm using that function, I usually just combine it with
transact! calls by wrapping both in an
and or something.
so, here's the deal: the set-value! isn't going to even work from inside a mutation unless you set
:ref, and it triggers an additional transaction itself...so it is kinda silly.
it's ok to trigger a new tx from a mutation...that's fine, though messy and harder to trace (since that makes it an async execution path. You're MUCH better off writing a mutation helper instead, and using that. See https://book.fulcrologic.com/#_mutation_helpers
env is the ident of the component that invoked the transaction in which the mutation is running, which is how
set-value! figures things out...you can, of course, do the same.
What’s the best way to add “computed” columns to RAD report? Something that would get its own column, but it is derived completely from other queried data. (and I’d prefer not to have in DB)
Make a resolver for it, and add it to
ro/row-query-inclusion or specify
ro/BodyItem and write the row query yourself along with rendering of it.