This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-08
Channels
- # adventofcode (55)
- # announcements (21)
- # babashka (20)
- # beginners (89)
- # calva (21)
- # cider (16)
- # circleci (11)
- # clara (8)
- # clj-kondo (6)
- # clojure (31)
- # clojure-australia (3)
- # clojure-europe (17)
- # clojure-nl (5)
- # clojure-uk (10)
- # clojurescript (25)
- # community-development (4)
- # conjure (12)
- # cryogen (28)
- # cursive (21)
- # datomic (7)
- # deps-new (1)
- # depstar (45)
- # emacs (5)
- # fulcro (46)
- # instaparse (5)
- # jobs (5)
- # jobs-discuss (23)
- # kaocha (12)
- # lambdaisland (2)
- # leiningen (1)
- # meander (10)
- # mid-cities-meetup (1)
- # reagent (5)
- # reitit (5)
- # remote-jobs (45)
- # reveal (9)
- # sql (6)
- # tools-deps (103)
- # uncomplicate (1)
- # xtdb (1)
Hi! I’ve been experimenting with and investigating multiple options for building a fullstack clojure/clojurescript app with RN as the main client app. Fulcro seems perfect for what I’m trying to build, and I’m really stoked about everything that’s been built out here and all the documentation. I am, however, planning on bypassing expo. Does anyone have any pointers on how to set that up with Fulcro?
@aleksander990 ummmm…let me see, I’ve got a bare RN app sitting around somewhere…
I think I followed the instructions for a bare react native app here: https://docs.expo.io/bare/exploring-bare-workflow/ But you don’t have to use the expo APIs (though I still find them convenient).
Unrelated to Fulcro: How much overhead does expo bare add vs react native CLI? (I was looking through the code here and trying to reverse engineer it for native native. https://github.com/fulcrologic/fulcro-native/blob/develop/src/main/com/fulcrologic/fulcro_native/bare.cljc). I’m a little worried about app size with expo, but from what I’m gathering it might not be too different than react native cli with bare
I got all that setup. The build is compiling and working as expected. I’m just trying to figure out the render-root part
what does this do? (i saw it but couldn’t quite figure out what it’s addding)
so you can plug in which algorithm is used to “refresh” after a transaction. This one normally renders from root, but supports you passing a targeted ident via transact!
to limit refresh to some specific component, which can be used to speed up large forms.
multi-root-render is just like KF2, but allows you to have disconnected nested data roots in the app.
ident-optimized-render tries to only update components whose data changes by analyzing the normalized database…but it turned out to be no faster in most cases, and is more complex to use.
ha ha, that’s fair. I’m thoroughly impressed with everything you’ve pioneered here. And your responsiveness on this. I appreciate knowing the “why”, so this makes me a lot more comfortable jumping in
I’d just look in the js and see what that does…it just adds a bit of expo magic in, but it stil lhas to call the RN low-level calls
import 'expo/build/Expo.fx';
import { AppRegistry } from 'react-native';
export default function registerRootComponent(component) {
AppRegistry.registerComponent('main', () => component);
}
ha ha, ok so I suppose that that, an asset management is the only thing that’s expo specific
Out of curiosity: Do you remember the approximate app size of your RN apps? It looks like the base bundle is quite a bit bigger than the the reagent build I got running (1.2mb vs 5.2mb when building for release). My guess is that it’s because Fulcro includes a lot else, but my app right now is nothing more than a view with text in it
Ok, changing for this is all it took: (.registerComponent rn/AppRegistry “main” (fn [] Root))
Ok, a few notes: • I’d be happy to do a PR with a native.cljc for use cases without expo. It’s a simple change, but that’ll make it easy for anyone to get started • The alpha UI components imports a few components that have been moved outside core RN library (it throws a couple of warnings. So they should be removed • Preassigning all the basic ui-components seem to make them part of the bundle - regardless of whether you use them. (they won’t be treeshaken). I don’t know if that has to do with how (comp/isoget) is implemented or something else. Easy solution is to simply not do it and leave it up to the user. Meaning I’ll only do the import for the components I actually need. And then have the components ns expose the react-factory helper function Let me know if you have any thoughts on it. Otherwise I’ll experiment some more tomorrow and submit some PRs to the repo
(1) sure, adding a new ns for that is fine (2) Sounds like removing them is the right thing to do. (3) If you don’t require it, nothing should end up in your build. If it is required where not needed, I’m open to a fix.
I did a low quality test for number 3: I build a production build with them and one without them and it resulted in a 200kb difference. I can try to look through the actual index file and document in a PR
For a very specific use case, is it allowed to access a component's parent via this
(ie. (.-fulcro$parent (.-props this))
) ? Or is it definitely not part of the public API?
the internal keys are unlikely to change names, but I make no guarantees about the internals of how components are implemented
@tony.kay Thanks, perfect. It seems to be a somewhat recent change as it was not part of the API version I was accessing on Cljdoc. Recent versions are faulty, namespaces don't show up. I tried rebuilding it but it fails.
This thread may be helpful: https://clojurians.slack.com/archives/C68M60S4F/p1607022810050300