Skip to content

Commit 18634de

Browse files
authored
remove set immediate (keybase#20599)
1 parent bde05fa commit 18634de

4 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎shared/desktop/app/menu-bar.desktop.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default (menubarWindowIDCallback: (id: number) => void) => {
101101
// Hack: open widget when left/right/double clicked
102102
mb.tray.on('right-click', (e: Electron.Event, bounds: Bounds) => {
103103
e.preventDefault()
104-
setImmediate(() => mb.tray.emit('click', {...e}, {...bounds}))
104+
setTimeout(() => mb.tray.emit('click', {...e}, {...bounds}), 0)
105105
})
106106
mb.tray.on('double-click', (e: Electron.Event) => e.preventDefault())
107107

‎shared/desktop/remote/store.desktop.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ class RemoteStore {
2727

2828
_onPropsUpdated = propsStr => {
2929
// setImmediate since this can be a side effect of the reducer which redux doesn't like
30-
setImmediate(() => {
30+
setTimeout(() => {
3131
this._store.dispatch({
3232
payload: {propsStr},
3333
type: updateStore,
3434
})
35-
})
35+
}, 0)
3636

3737
if (this._gotPropsCallback) {
3838
this._gotPropsCallback()

‎shared/desktop/renderer/main2.desktop.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,22 @@ const setupApp = (store, runSagas) => {
6868
SafeElectron.getApp().on('KBdispatchAction' as any, (_: string, action: TypedActions) => {
6969
// we MUST convert this else we'll run into issues with redux. See https://github.com/rackt/redux/issues/830
7070
// This is because this is touched due to the remote proxying. We get a __proto__ which causes the _.isPlainObject check to fail. We use
71-
setImmediate(() => {
71+
setTimeout(() => {
7272
try {
7373
store.dispatch({
7474
payload: action.payload,
7575
type: action.type,
7676
})
7777
} catch (_) {}
78-
})
78+
}, 0)
7979
})
8080

8181
// See if we're connected, and try starting keybase if not
82-
setImmediate(() => {
82+
setTimeout(() => {
8383
if (!eng.hasEverConnected()) {
8484
SafeElectron.getApp().emit('KBkeybase', '', {type: 'requestStartService'})
8585
}
86-
})
86+
}, 0)
8787

8888
// After a delay dump logs in case some startup stuff happened
8989
setTimeout(() => {

‎shared/engine/index-impl.tsx‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,7 @@ class Engine {
217217
incomingCallMap: p.incomingCallMap,
218218
waitingKey: p.waitingKey,
219219
})
220-
// Don't make outgoing calls immediately since components can do this when they mount
221-
setImmediate(() => {
222-
session.start(p.method, p.params, p.callback)
223-
})
220+
session.start(p.method, p.params, p.callback)
224221
return session.getId()
225222
}
226223

0 commit comments

Comments
 (0)