Fork me on GitHub
#re-frame
<
2022-09-15
>
erwinrooijakkers08:09:51

Does anyone have suggestions for performance profiling tools? Is it, for example, possible to load cljs source maps in the Chrome Performance tab? So we can see more clearly what cljs functions are being called?

erwinrooijakkers08:09:26

Also with re-frisk tracing on we can see reasonably clearly what evens take what time, but maybe there are better ways I am missing.

p-himik08:09:59

re-frame-10x has some timings as well. But your browser's profiling is the most fine-grained solution possible. And yes, source maps should work there if they work in the Sources tab.

erwinrooijakkers08:09:05

They don’t work in Sources tab so have to configure those properly locally

erwinrooijakkers14:09:54

The app.js.map is available when I navigate to the URL, but it does not show up in Sources, only app.js does 😕 any idea?

p-himik14:09:26

Probably app.js doesn't specify that it has a source map.

p-himik14:09:59

With shadow-cljs, it should be automatic. No clue about other build tools.

erwinrooijakkers07:09:46

we use shadow-cljs, and the end of the file app.js has

//# sourceMappingURL=app.js.map

erwinrooijakkers07:09:57

the app.js.map file does exist as well

erwinrooijakkers07:09:25

we do add a “cache buster” at the end of the file in index.html

<script src="/js/compiled/app.js?version=COMMIT_HASH"></script>

erwinrooijakkers07:09:36

but in sources this app.js.map is just not visible

p-himik10:09:14

Do you have source maps enabled in the browser? Is the source map accessible via the /js/compiled/app.js.map URL?

p-himik16:09:49

Weird, no clue.

scarytom10:09:46

I'm doing some unit testing for my re-frame app, and I'm following the examples here: https://github.com/day8/re-frame-test#how-it-works However, when I run my tests, I get a load of warnings like this in the console:

re-frame: Subscribe was called outside of a reactive context.
 See: 
 
Digging into the re-frame and reagent code, I have found that I can suppress this warning by wrapping the test body in a reagent.ratom/check-derefs call like this:
(deftest init
  (rf-test/run-test-sync
    (reagent.ratom/check-derefs
      (fn []
        (let [showing (rf/subscribe [:showing])]
          (is (= :all @showing)))))))
This looks pretty ugly. Is there a better way?

tumbleweed 1
erwinrooijakkers14:09:15

Are you running inside the run-test-sync macro?

scarytom17:09:32

Yes, as shown above