Fork me on GitHub
#fulcro
<
2018-03-11
>
bbktsk00:03:27

Hi, I have a code organization/aesthetical problem. I have two files/namespaces: a.b.c.person`` (contains defsc`` for the Person component) and a.b.c.mutations``. A mutation mutty`` has a remote part and after it executes, I need to reload the Person in question to see the changes server made. Follow 9.8.1. Load Actions in Mutations from the fulcro book, that’s done by (load-action env ident Person)``, but that means the a.b.c.mutations``` namespace must require the a.b.c.person`` namespace to have access to Person`` component. But also, to be able to use short name of the mutation mutations/mutty`` in the a.b.c.person`` namespace, I need to do require [a.b.c.mutations :as mutations]`` in a.b.c.person``. And that’s a circular dependency. Now, I understand that a mutation name is just a symbol and writing its full name a.b.c.mutations/mutty`` works (and that’s what I am doing at this moment), but that extra a.b.c`` (in my case somewhat longer) is quite ugly and keeps bugging me. Is there some way around this? Or should I just bite the bullet and write that extra few characters?

sundarj00:03:41

@bbktsk you can use the alias function instead of requiring the mutations namespace

sundarj00:03:46

=> (alias 'str 'clojure.string)
nil
=> `str/foo
clojure.string/foo

bbktsk00:03:12

@sundarj Awesome, exactly what I needed. Thanks!

sundarj00:03:36

no prob 🙂

levitanong01:03:30

@tony.kay In fulcro-spec, when I use =throws=>, I’m getting an error saying throws? isn’t defined in my namespace. Fulcro-spec’s source emits a throws? symbol when =throws=> is used, but it doesn’t seem to be in any of the core clojure namespaces. Perhaps there’s a missing require in fulcro spec?

magra14:03:05

I have a (defsc CompanyPage ...) that follows the example of the report router in the book and video. It points to [:company/by-id :db/id]. [company/by-id db/id] has a key :company/offices. If a mutation adds to company/offices everything works fine if the key is there. But if the key is not there and the first office gets added the new entry and the key gets created fine in the client-db as shown by fulcro-inspect but the ui does not pick up the change. Navigating away and back shows the entry. A work around is to have the server send an empty vector on initial load but this gets nasty as I add keys. Do I tackle this with initial-state or refresh? I tried both.

tony.kay18:03:08

@levitanong what versions of things? It should work, and in fact I've used that exact feature recently. @magra follow-on read? See the :refresh option of load. The other option is to use :keyframe rendering mode

bbktsk20:03:27

@tony.kay What is the effect of :validate-on-blur false on text-input? I’ve grepped the code for ‘validate-on-blur’, but can not find any usage except at the component construction…