Fork me on GitHub
#clojurescript
<
2021-01-04
>
erwinrooijakkers15:01:28

Are there any libraries or ideas for only performing effects (like backend calls) for Reagent components that are actually visible on the user’s screen? Maybe by utilizing `js/IntersectionObserver`? Maybe by not even loading the component using a library?

Alexis Vincent15:01:31

If I hold a symbol in cljs that maps to a namespaced var, is there a way to perform a lookup of the var at runtime?

thheller17:01:19

CLJS doesn't have vars at runtime but you can get whatever would be in the var via (js/goog.getObjectByName "cljs.core.assoc") or so

clyfe17:01:13

Does that work with optimizations? @U05224H0W

Alexis Vincent17:01:21

Awesome thanks!

thheller17:01:35

no it does not

clyfe18:01:14

Yeah, I tried this sort of stuff for https://github.com/tape-framework and settled with registering things and latter retrieval from the registry.

clyfe18:01:34

because optimizations erase the names

Alexis Vincent22:01:53

cool. Thanks for the pointers

Alexis Vincent15:01:09

Is there a way to compute requires using macro’s or reader macro’s at compile time? Or something similar?

Alexis Vincent17:01:06

yes! I think so!

erwinrooijakkers18:01:20

Are there any libraries or ideas for only performing effects (like backend calls) for components that are actually visible on the user’s screen? Maybe by utilizing `js/IntersectionObserver`? Maybe by not even loading the component using a library?

p-himik18:01:11

Please try to avoid posting the same question in multiple channels, let alone multiple times in the same channel.

erwinrooijakkers12:01:11

Oh oops I thought my connection was lost

erwinrooijakkers12:01:28

And the question was not posted

erwinrooijakkers12:01:57

but no solutions I see

erwinrooijakkers12:01:03

nor on the internet specific to re-frame. then we roll our own 🙂

p-himik12:01:17

When in doubt, try ctrl+shift+r (at least on Windows and Linux - MacOS may have some other shortcut) - it will refresh the desktop Slack app.