mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-18 06:28:40 -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>
|
<div id="mount"></div>
|
||||||
<script>start = performance.now();</script>
|
<script>start = performance.now();</script>
|
||||||
<script src="dist/bundle.js"></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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,16 @@ import {
|
||||||
export function addSession (uid) {
|
export function addSession (uid) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const { sessions } = 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;
|
const initial = null == sessions.activeUid;
|
||||||
return dispatch({
|
if (initial) rpc.emit('init');
|
||||||
|
|
||||||
|
dispatch({
|
||||||
type: SESSION_ADD,
|
type: SESSION_ADD,
|
||||||
uid,
|
uid
|
||||||
effect () {
|
|
||||||
if (initial) {
|
|
||||||
rpc.emit('init');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue