Fork me on GitHub
#fulcro
<
2018-10-14
>
eoliphant14:10:56

Hi, working through the form state support. any guidance/tips on using it in devcards

tony.kay18:10:40

@eoliphant I do things like set up mock networking so I can play full stack without a server

tony.kay18:10:51

the fulcro.server ns has that for the client

tony.kay18:10:11

Then you can do your loads and such from started callback in the fulcro cards, etc. See the book demo source

tony.kay18:10:29

and of course prim/merge-component is handy for just shoving in instances of something that can then be configured with form data

wilkerlucio19:10:27

just released fulcro-inspect jar 2.2.4 and chrome extension updated to 1.0.6, this updates fixes a bug in the diff algorithm when you have maps that contains maps as keys, thanks for the nice reproducible case @magra!

🙂 8
bananadance 8
hmaurer19:10:24

@tony.kay how bad can the performance impact get of putting every keystroke (i.e. input fields) in the global state atom?

currentoor20:10:07

it really depends on your use case and application

currentoor20:10:10

if your app is well tuned (using union queries etc.) and you’re not doing anything fancy (like live updating a preview on every keystroke (which should be debounced anyway)) then it should be fine

currentoor20:10:25

i always default to using app state for inputs and mostly haven’t had issues, (m/set-string! this :ui/query :event evt) makes it easy

currentoor20:10:20

then if and only if it actually turns out to be a performance bottleneck then i try to optimize

currentoor20:10:42

if it’s slow i’ve used a combination of key, default-value, and onBlur

(dom/input
 {:key          title-val
  :defaultValue title-val
  :placeholder  "Ex: foo bar baz"
  :onBlur       #(m/set-string! this :ui/field :event %)})

currentoor20:10:38

this lets you still use app state but the input is uncontrolled and only invokes a mutation on blur

currentoor21:10:52

does that make sense?

hmaurer21:10:39

@currentoor it does; thank you! I’ll read the book section and union queries right away

currentoor21:10:36

union queries are tricky to understand at first, i would get one of the examples from the book working in your own source code first, like in a dev card

currentoor21:10:49

then use it as a reference when building your own unions

currentoor21:10:32

Tony’s done a lot of work to make unions easier with defrouter, but it still gets me sometimes 😅

Daniel Hines22:10:24

Is there a way to register a Pathom parser with the easy server?

tony.kay23:10:04

@d4hines sorry, I wasn’t reading clearly…listen to Wilker

Daniel Hines23:10:33

Ok. Are there any canonical fulcro+pathom examples? I know there's Walkable's realworld example. Any others?

wilkerlucio00:10:58

there is not a lot of secret, pathom will give you the parser, so you just have to create some http handler that gets the query/tx and send to the parser as the second argument

wilkerlucio00:10:22

are you having dificulties with some specific part of it?

Daniel Hines23:10:33

Ok. Are there any canonical fulcro+pathom examples? I know there's Walkable's realworld example. Any others?

hmaurer23:10:05

I have a quick question around data loading with Fulcro, when someone knowledgeable passes by: what is the standard way to load different data on different routes? Also, is there a way to load data in a standalone, embeddable component? For example with Apollo (GraphQL) it is fairly straightforward for a component to run a query when it is rendered.

hmaurer23:10:58

however it feels a bit odd to me to trigger a load query as a mutation before transitioning to a new route