Fork me on GitHub
#fulcro
<
2018-08-29
>
oscar02:08:07

The 2.6.0 changelog claims that app-state can now take components. But fulcro.client.primitives/app-state still has the precondition (reconciler? reconciler). Was this included in the changelog by mistake?

tony.kay13:08:26

Hm…I thought I added that…perhaps I munged a merge 😕

tony.kay13:08:19

Ah, right, I changed my mind on how that should work: primitives/component->state-map

tony.kay13:08:44

a component really shouldn’t directly use the atom, but there are rare cases where just pulling the current db makes some sense.

tony.kay14:08:57

fixed the changelog. Thanks

Raghu07:08:07

Anyone here tried using fulcro with react-native. Any documentation / setup blogs available?

grease07:08:58

I'm curious about this too. Would appreciate any pointers from the community here. Thanks

tony.kay14:08:58

So, it works. I tried it some time ago, and so has @U066U8JQJ. I have not had time to document it…but essentially you can override the root render when creating a client, and then use your own wrappers for UI stuff instead of DOM.

👍 4
wilkerlucio14:08:43

no docs, but I have a POC repository, you can copy stuff from it: https://github.com/wilkerlucio/multi-timer

👍 4
grease02:08:28

Thanks @U066U8JQJ. Will check it out.

claudiu08:08:43

@thheller Silly question but can't seem to figure it out 😅 How do you start the dashboard "dev" with hot-reload ? Cloned the shadow-cljs repo and wanted to play a little with the fulcro ui stuff

thheller09:08:12

dashboard dev?

thheller09:08:49

ah you mean work on the web UI itself?

claudiu09:08:59

that you get from shadow-cljs server but with hot reload 🙂

thheller09:08:13

first cd packages/ui; npm install

thheller09:08:45

then lein with-profiles +cljs repl (require 'repl) (repl/go)

thheller09:08:25

(shadow.cljs.devtools.api/watch :ui)

thheller09:08:50

then opening the above url should use the development version

cjmurphy09:08:07

@claudiu Here's where I did it, using meta data: https://github.com/chrismurrph/fulcro-react-vis/blob/master/src/main/general/user.cljs. Also the lein template does it with some config in the shadow-cljs.edn file (so not using meta data).

claudiu09:08:54

nice 🙂 still getting the hang of this config stuff. I've been relying on fulcro-template with shadow-cljs for my projects. Now cloned shadow-cljs and got a bit stuck with how to build stuff 😄

cjmurphy09:08:03

I realised belatedly (after publishing the Medium article) that I didn't have hot-code reload set up 🙁. So good IMO to just have examples of config code that you can just look at simple_smile

thheller09:08:31

@claudiu might need to call (repl/go) and the watch twice. the server currently only serves the dev-ui if the .shadow-cljs/ui folder exists which it won't the first time you call (repl/go)

claudiu09:08:55

@thheller it's working now. Thank you 🙂

thheller09:08:47

what you are up to?

claudiu10:08:18

Was curious about the interface (not a lot of oss fulcro projects) and want to look a bit into the ::active-build '_ stuff you mentioned.

exit214:08:29

Whats the correct pattern for fetching data from a service then updating the UI? I’m using df/load-action and data is coming back but its causing my components to do weird things (i.e. go back to its default view)

cjmurphy15:08:08

@njj Does the data look okay when viewed from Fulcro Inspect? It would be good to know the state before and after the df/load-action.

cjmurphy15:08:06

It would seem that the load is not putting the data where it should go.

cjmurphy15:08:53

There are a lot of examples in the book on loading and targeting the load, and doing post-mutations for more complex cases e.g. http://book.fulcrologic.com/#_targeting_loads

manutter5115:08:25

“more than one x” 🙂

manutter5115:08:51

also [k & ks], [coll & colls], etc

tony.kay16:08:48

@njj The correct pattern is to use load with :refresh and :target.

tony.kay16:08:34

The UI refreshes are data-driven, so you indicate, via query property keywords, what data has changed. Fulcro keeps an index of components that have queried those keywords, and refreshes all of them that match.

tony.kay16:08:10

Load, in and of itself, cannot just figure that out, since you could target data, or run post mutations, and modify any arbitrary thing.

tony.kay16:08:53

If you’re seeing things “go back in time”, I’d be interested what version of Fulcro you’re using. The React 16 stuff is new rendering alg…so, does it also do unexpected things in 2.5.12 with React 15?

exit216:08:17

currently on 2.5.8

tony.kay16:08:13

OK, so that loads the data into the root node…is that where you want it? I would expect a target

exit216:08:26

yeah it shouldn’t be root node

exit216:08:37

so I need to update that then

tony.kay16:08:46

also, if you’re using links [:space-details '_] to get to it, then you’re doing it in a non-recommended way

tony.kay16:08:44

load cannot figure out a target. It defaults to loading into the root. But if everything has an ident, then the proper target is just a 3-tuple…so add :target [:table id :field] to your load’s parameters

tony.kay16:08:55

(where you define the three elements, of course)

tony.kay16:08:28

and then also add to the :refresh list…e.g. add another parameter of :refresh [:field]

tony.kay16:08:01

the :field will be obvious, and will also be what your UI component query for…so the two will naturally correspond.

tony.kay16:08:57

Now, I would also recommend that you use load, and not a mutation with load-action. The latter is for when you need a mutation to do something and also load…in your case, you just need load.

tony.kay16:08:05

(not a mutation)

exit216:08:26

yeah the reason its probably the non-recommended way is because this was originally an untangled project, which has been ported over to fulcro recently

tony.kay16:08:08

that hasn’t really changed 🙂 But can see why there might have been earlier misunderstandings

pvillegas1222:08:25

How does one include something like bootstrap css in a fulcro app?

eoliphant23:08:51

nothing special, just the normal style tag to your index.html