Fork me on GitHub
#fulcro
<
2018-08-31
>
veddha07:08:12

Hey, did someone know how to usu ::webkit-input-placeholder on css fulcro 2.6?

wilkerlucio11:08:28

@veddha.riady I dunno exactly, but you might find something over garden docs, in the end fulcro uses garden to compile the CSS: https://github.com/noprompt/garden/wiki/Syntax

thheller12:08:20

so I was under the impression that fulcro did not re-render from root but instead only re-render changed idents. was I wrong or am I doing something wrong?

wilkerlucio12:08:39

@thheller it does targeted updates, but how much may vary, I didn't checked closely, but the main idea is that re-render is governed by follow-up reads (or refresh in terms of mutations), so all the components with the same ident will refresh, but also any components that contains the attributes mentioned in the follow up read (and in case of loads fulcro automatically adds some things there)

wilkerlucio12:08:02

that said, there were changes that are less optimal than before since 2.6.0, so if you notice some weird root render that could be a bug

claudiu12:08:51

@thheller think there is also the rendering modes part. Think the fulcro lein template now has :keyframe added as default. http://book.fulcrologic.com/#_rendering_modes

☝️ 4
cjmurphy12:08:44

Also normally called 'follow on' reads.

pvillegas1214:08:10

If I have a presentational component (for fulcro, one that does not use defsc, ie. does not have a query or ident, purely presentation) I can use a regular function to emit the DOM I need. However, if I need the presentational component to use a callback / computed, do I need to necessarily use a stateful defsc component to pass in the computed?

wilkerlucio14:08:07

@pvillegas12 if you are not using query, don't mind computed, just send everything in props

pvillegas1214:08:44

got it, so the computed is for a stateful component for rendering optimization?

thheller17:08:24

regarding my earlier question about rendering from root: I made a small demo repo showing that render always happens from root and I want to find out why or how to optimize it? any feedback/suggestions are welcome https://github.com/thheller/fulcro-questions/issues/1

pvillegas1218:08:49

@thheller how can you tell it’s rendering everything from root?

pvillegas1218:08:16

@thheller I’m not sure that the console statement means its re-rendering the root

thheller18:08:05

its the render fn of the component so what else would it mean? (it is absolutely possible that my assumptions are incorrect)

wilkerlucio18:08:53

rendering is usually not the most costly operation, computing the data for it is (`db->tree`), I think it's worth the investigation anyway, I myself use a project that can suffer if things are not optimized (quite large app)

thheller18:08:39

yeah I'm not saying that this is a problem

thheller18:08:45

just not what I expected

wilkerlucio18:08:44

I'm glad you are bringing it out, this is an important part I didn't had the time to inspect close and see if the opt is working as its supposed to, @tony.kay did some changes on 2.6, in prod I'm not having performance issues, but that doesn't mean it's optimal 🙂

wilkerlucio18:08:44

@thheller just curious, why you changed the :root-render in the example?

thheller18:08:39

ah. can take it out. in my UI app I'm not using fulcro.client.dom so the default js/ReactDOM doesn't exist

wilkerlucio18:08:52

I have one tip for your mutations

wilkerlucio18:08:13

you can instead write:

wilkerlucio18:08:28

(defmutation set-name [{:keys [id name] :as params}]
  (action [{:keys [state ref] :as env}]
    (js/console.log ::set-name params)
    (swap! state update-in ref assoc ::name name)
    ))

wilkerlucio18:08:48

in the tx env you have the ref, which is the ident of the component that triggered the mutation

wilkerlucio18:08:02

this way you can always target the correct data point in the app db, making your mutations more generic

wilkerlucio18:08:19

then the mutation would be: (db.h/swap-entity! env assoc ::name name)

pvillegas1219:08:31

@thheller interestingly enough, doing :shouldComponentUpdate (fn [_ _] false) on Root will not update the children (the name does not change)

thheller19:08:02

makes sense if its rendering from root

pvillegas1219:08:00

With React, if children’s props change, even if the parent does not update, the children will re-render

thheller19:08:00

the child props can't change if the parent doesn't update because it is passing the props