Fork me on GitHub
#fulcro
<
2018-09-01
>
tony.kay03:09:31

@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.

tony.kay03:09:06

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.

tony.kay03:09:28

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.

tony.kay03:09:43

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

thheller08:09:27

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.

tony.kay03:09:17

It’s basically equivalent to using PureComponent in plain react

vaedasynapse07:09:17

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
roklenarcic14:09:55

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

hjrnunes14:09:26

@tony.kay I'm struggling to get a dropdown working with https://github.com/fulcrologic/semantic-ui-wrapper This doesn't work:

(defcard dropdown
  (dom/div
    (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
  (dom/div
    (f/ui-dropdown {:text "A Dropdown"
                    :options [{:text "A"} {:text "B"}]})))

tony.kay16:09:52

@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.

tony.kay16:09:54

@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.

pvillegas1219:09:23

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

pvillegas1219:09:02

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

dcj19:09:20

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.

(make-fulcro-server
       :parser-injections #{:config :database}
       :components {:database (new-database { map-of-db-spec }}
       ...)
`

pvillegas1220:09:31

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

tony.kay22:09:07

@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.

pvillegas1202:09:10

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.

tony.kay22:09:52

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.

tony.kay22:09:46

@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.

tony.kay22:09:00

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

dcj22:09:32

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