Fork me on GitHub
#fulcro
<
2019-06-12
>
tony.kay01:06:29

3.0.0-alpha-5 is on clojars. I fixed a problem with inspect, added support for mutation joins via returning et al. Basically these releases are slowly adding little bits that got missed here and there. This release also adds back support for explicit initial state (not component-based) which is used by some apps…particularly demos, though I change the API just a bit…see docstrings if you use that.

tony.kay01:06:29

I’ve ported a number of the book demos. So far it has mostly been just changing namespaces and minor updates here and there.

tony.kay01:06:01

The following are now known to work (because I tried them): - Union Router - The older dynamic router, including loading on code splits. API will change here a little, since we have a component registry now…no extra multimethod needed. - I’ve partially tested the new dynamic router (and by proxy UI state machines), but not heavily…and the docs need updated because fewer macros are needed. - Supplying an alternate initial state to an app as a normalized db - Mutations that return things w/targeting - Data fetch in general There is preliminary support for ok-action and error-action in all mutations, though it is not documented. The env contains a lot more stuff than it used to, so you can find things like the raw network result, status code, original query/tx, etc.

tony.kay02:06:19

I’ve got a new lein template app written, but not integrated by into the template itself. The temporary repo where I’m building the content is here if anyone wanted to clone it as a starter: https://github.com/fulcrologic/fulcro3-template

🙏 12
kszabo09:06:02

I would like to thank you for moving towards a deps.edn + shadow-cljs based tooling. I see that you are only using leiningen for it’s uberjar capabilites. I would like to put another tool on your radar: https://github.com/tonsky/uberdeps While this doesn’t do AOT or manifest generation either (those are questionable requirements IMO), it does the uberjar work of depstar in a better way. See this blogpost: https://tonsky.me/blog/uberdeps/

tony.kay14:06:58

Thanks, yes, I am aware of the tooling in deps that is trying to do uberjar. I have had mixed luck so far, so I’m really just waiting for those tools to stabilize. I use depstar in a project of my own, but have seen it crash and burn on another. When I have time I will look at the field…I do plan on removing project.clj from the template for 3.

👍 4
kszabo09:06:02

I would like to thank you for moving towards a deps.edn + shadow-cljs based tooling. I see that you are only using leiningen for it’s uberjar capabilites. I would like to put another tool on your radar: https://github.com/tonsky/uberdeps While this doesn’t do AOT or manifest generation either (those are questionable requirements IMO), it does the uberjar work of depstar in a better way. See this blogpost: https://tonsky.me/blog/uberdeps/

exit214:06:34

I have an interesting issue where on submit of a form (fs/dirty-fields etc..). I’m not seeing the updated subform values until I also update a parent form value, then I will see both values in the diff. Any ideas?

mitchelkuijpers14:06:33

Then you are not refreshing correctly

mitchelkuijpers14:06:54

You are probably doing a tx somewhere where you don't refresh the parent form

exit214:06:13

Yeah I’m starting to think its related to not marking the subform field complete onBlur.

mitchelkuijpers14:06:37

No you have a tx that is not triggering a re-render of the parent form

exit214:06:14

The only transaction for the field is onChange (m/set-integer!)

exit214:06:26

Its a simple text input

mitchelkuijpers14:06:45

That is not enough it needs to refresh the parent form, so it needs a refresh key of the parent form

exit214:06:47

Ah, and where would I put that? Is it not something that would be in the field?

mitchelkuijpers14:06:57

what is the complete: (prim/transact []) call?

exit214:06:37

right now I’m just consoling (fs/dirty-fields props false)

exit214:06:48

So I’ll add a transact of some sort, then do that

mitchelkuijpers14:06:14

Ah you use the m/set-integer!

mitchelkuijpers14:06:38

you have a version without the ! which you can use in the tx

mitchelkuijpers14:06:48

if you then add fs/form-config-join as a refresh key it should work

mitchelkuijpers14:06:54

or the ident of the form

exit214:06:45

Ok, so there is a m/set-integer method, I use it has a tx rather than just calling the ! version as a function?

mitchelkuijpers14:06:50

If you look at the source of that function you see it does a prim/transact

exit215:06:17

Awesome, trying now. Thanks

mitchelkuijpers15:06:08

you need to do:

(prim/transact! `[(---your-tx----) ~fs/form-config-join])

mitchelkuijpers15:06:01

mark-complete on blur might also fix it btw

mitchelkuijpers15:06:36

And then adding the refresh key there

mitchelkuijpers15:06:54

Just remember if the data seems wrong but the app-state is correct this is probably the issue: http://book.fulcrologic.com/#_follow_on_reads

👍 4
exit215:06:09

Yeah using mark-complete correctly w/ the form-config-join key seems to do the trick 👌

jtouron15:06:08

Hello, I was wondering if there's a recommended way to add specs to a component's props?

tony.kay15:06:37

@jtouron Well, if you’re using namespaced keywords, then it is a simple as doing an s/def on that keyword

tony.kay15:06:33

if you mean “how do I check the specs”, well, that is a runtime overhead that you would not normally want, but you could easilly just do an (assert (s/valid? (s/keys :req […]) props))

tony.kay15:06:05

If you mean “how do I *automatically make it so all of my components check their props” the answer is “write a macro…it’s lisp”

tony.kay15:06:35

Fulcro 3 (in alpha) has render middleware where you could probably automate this as well…have to think abt it (which I’m not going to do right now 😉 )

jtouron16:06:23

@tony.kay Thanks for the response. I was thinking about just doing a (s/assert ::props props) after the component's options map, which sounds similar to what you suggested, but was just curious if maybe someone had a better way. One last question: Is there a way to set the value of clojure.spec.alpha/*compile-asserts* when shadow-cljs compiles? The documentation says that the value of 'clojure.spec.compile-asserts' system property can be set, but I believe that's JVM only and I don't know if that translates somehow to shadow-cljs.

tony.kay16:06:02

@jtouron I would suggest you look at gnl/ghostwheel

tony.kay16:06:20

I use it for my projects to deal with the issues of instrumentation, and really like it

tony.kay16:06:53

in answer to your specific question: don’t know off top of my head

jtouron16:06:59

@tony.kay Will do, thanks again for the help.

tony.kay23:06:13

Alpha 6 is on Clojars:

3.0.0-alpha-6
-------------
- Added official hooks to a number of places, and added a bit to docs
- Finished defining the "default" amount of pluggability for default mutations
- Make global query transform apply closer to the network layer to catch both mutations and queries
- Added confirmation tests to some more elements of merge join and pre-merge
- 

tony.kay23:06:04

The big add here is that now when you create an application there are a number of “hook points” where you can customize functionality. See the docstring on fulcro-app in applications.cljc.

bananadance 24
💯 16