Skip to content

Commit 21da99c

Browse files
committed
Reduce the number of protocol entries in the UI
1 parent 2b7d269 commit 21da99c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/store.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import {Config, GcState, State} from "./proto";
44

55
Vue.use(Vuex);
66

7+
const maxProtocolEntriesString = window.localStorage.getItem('maxProtocolEntries');
8+
let maxProtocolEntries = 50;
9+
if (maxProtocolEntriesString !== null) {
10+
maxProtocolEntries = parseInt(maxProtocolEntriesString);
11+
} else {
12+
window.localStorage.setItem('maxProtocolEntries', maxProtocolEntries);
13+
}
14+
715
export default new Vuex.Store({
816
state: {
917
gcState: GcState.create(),
@@ -27,6 +35,9 @@ export default new Vuex.Store({
2735
} else {
2836
state.protocol = message.protocol.entry;
2937
}
38+
if (state.protocol.length > maxProtocolEntries) {
39+
state.protocol = state.protocol.slice(0, maxProtocolEntries);
40+
}
3041
}
3142
if (message.gcState) {
3243
state.gcState = message.gcState;

0 commit comments

Comments
 (0)