Fork me on GitHub

@thheller The new rendering alg always renders from root, but every component has a shouldComponentUpdate that short-circuits rendering if their props haven’t changed. Also, the props are patched by only querying the components that are being re-rendered.


2.5 and below did queries against the component updating, and did forceUpdate on the components, but it had to do a lot of backflips to try to make lifecycle work right because React didn’t send the correct prior state/props. It was actually a lot of complexity that had bugs and other issues moving forward.. React wants you to render from root. always. The shouldComponentUpdate is the primary optimization, and it is a cheap and good one for Fulcro. The main performance cost in the Fulcro world is the query to construct the props. There are still things we can do there to improve that performance, but what I am doing currently is re-running the query starting at the places where updates are needed, patching those into the prior props, then re-rendering from root. This makes the whole thing work correctly, and should also make things right for React 17 and async rendering. The forceUpdate stuff was almost certainly going to just keep breaking, and it didn’t buy much in terms of where the real performance pinch points were.


Of course, this does mean that the root will be asked to render every time, as will things along the branch to the location of the real targeted update. Much like the overhead of an assoc-in: the path has to be re-created…but then React also does diffing on the VDOM, which means even that is pretty cheap.


If you’re seeing a real performance issue, I’d love to hear about it.


well right now there is one due to me using pprint but it should be fine overall. was just checking if my assumptions were incorrect or if I just was missing something I was supposed to do. thanks for clearing that up.


It’s basically equivalent to using PureComponent in plain react


Thanks so much for all the time and effort you are all putting into such a cutting edge and mind blowing library. I was about to ask a question about css best practices but I just stumbled across the dom_cards.cljs on github and it’s answered my questions up to now. But I did still feel like saying thanks.

fulcro 12
👍 8

shadow-cljs isn't the default in the new app template?


@tony.kay I'm struggling to get a dropdown working with This doesn't work:

(defcard dropdown
    (f/ui-dropdown {:text "A Dropdown"}
                   (f/ui-dropdown-item {:text "A"})
                   (f/ui-dropdown-item {:text "B"}))))
No options are shown. Just the the dropbox with "A Dropdown" text. But this does. I get options A and B:
(defcard dropdown
    (f/ui-dropdown {:text "A Dropdown"
                    :options [{:text "A"} {:text "B"}]})))


@roklenarcic The docs all talk about figwheel, and I have not had time to update them all. I would personally recommend and prefer shadow-cljs as the default, but until I can get ahead of the docs, I don't want to change it.


@hjrnunes according to the react semantic ui docs, you need a dropdown menu in between the dropdown and the options. See the docs for react semantic ui.


Is there an example of working with a model/id route handler using defrouter? Looking at the guides the id is hardcoded to :a for the graph, not sure how to dynamically get the route param and call the right component


(looking the the fulcro db, seems like the keys are hardcoded to the id :a)


WRT make-fulcro-server, I want to pass in a Sierra component that itself needs access to the configuration in order to be created. Can I leverage the read-in config (which hasn't be read yet?) or should I just read the config myself so I can create/new my component, and pass it into make-fulcro-server? e.g.

       :parser-injections #{:config :database}
       :components {:database (new-database { map-of-db-spec }}


to answer my question: I need another router (apart from a static top router) with a mutation that ensures the correct ident exists for the routing to happen


@pvillegas12 If you use the param namespace on a keyword, combined with a routing tree, you can pass route parameters (which can be derived by something like bidi) and a param like :param/a in an ident will be replace by the route parameter a. There is also a multimethod in there that you can extend to coerce the string value of such a parameter to some other type.


Yeah, I was answering my own question. I had a model/id URL with a :param/id query parameter but I was hitting a wall with the example toprouter having to be static (for the various top level routes) and dynamic for the model/id part.


not sure if that is what you're asking, or if you mean that you are answering your own question because you figured out what you needed.


@dcj You just add :config as a dependency of your component, and it will get the config injected into it at startup...that's a normal function of component library.


(component/using (my-component) [:config])


@tony.kay Thanks, I will give that a try!