re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
dazld 2020-06-16T17:31:59.401600Z

hey, just wondering if any of you have come across this before - dispatches aren't processed in safari when the browser window isn't active.

dazld 2020-06-16T17:36:00.403400Z

the queues are processed when the tab is made active / browser window becomes visible etc

2020-06-16T17:36:03.403500Z

Has anyone used re-frame + react-native with microsoft’s new macos and windows targets?

👀 1
➕ 1
dazld 2020-06-16T17:39:29.403700Z

not just safari, so I guess this is by design?

2020-06-16T17:58:41.403900Z

Oh, you might be hitting a requestanimationframe thing? Reframe uses that for working out when to re-run computations. I believe browsers pause that when the window is inactive. Docs reference: https://github.com/day8/re-frame/blob/master/docs/flow-mechanics.md#truth-interlude

👍 1
dima 2020-06-16T18:14:54.404200Z

re-frame runs dispatch events on goog.async.nextTick https://github.com/day8/re-frame/blob/master/src/re_frame/router.cljc#L187 which seems not executed in background https://github.com/google/closure-library/blob/d55cca5b83d573f8db10f6cceae243b246db1f23/closure/goog/async/nexttick.js#L54

👍 1
dazld 2020-06-16T18:46:15.404600Z

yep, rAF is paused when the tab isn't visible

dazld 2020-06-16T18:46:52.404800Z

@trybeee setImmediate calls aren't processed in the background, when tabs are inactive?

dazld 2020-06-16T18:48:52.405Z

oh, there's terrible browser support for it! looks like nextTick will almost always use the polyfill

dazld 2020-06-16T18:55:34.405200Z

so i guess what's happening is that the dispatch queue is being processed, but the reactions aren't.

dima 2020-06-16T19:04:57.405600Z

@dazld you’re right. background timers are processed in background (no more than 1 per sec though in Chrome) https://developers.google.com/web/updates/2017/03/background_tabs#background_timer_alignment but rAF is not

dazld 2020-06-16T19:25:02.406400Z

Super interesting, thanks!