mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
performance improvement
This commit is contained in:
parent
5e3e2c6a7d
commit
4a59c13c77
2 changed files with 9 additions and 8 deletions
|
|
@ -21,6 +21,6 @@
|
|||
<div id="mount"></div>
|
||||
<script>start = performance.now();</script>
|
||||
<script src="dist/bundle.js"></script>
|
||||
<script>console.log('bundle init:', performance.now() - start);</script>
|
||||
<script>console.log('total init time', performance.now() - start);</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -22,15 +22,16 @@ import {
|
|||
export function addSession (uid) {
|
||||
return (dispatch, getState) => {
|
||||
const { sessions } = getState();
|
||||
|
||||
// normally this would be encoded as an effect
|
||||
// but the `SESSION_ADD` action is pretty expensive
|
||||
// and we want to get this out as soon as possible
|
||||
const initial = null == sessions.activeUid;
|
||||
return dispatch({
|
||||
if (initial) rpc.emit('init');
|
||||
|
||||
dispatch({
|
||||
type: SESSION_ADD,
|
||||
uid,
|
||||
effect () {
|
||||
if (initial) {
|
||||
rpc.emit('init');
|
||||
}
|
||||
}
|
||||
uid
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue