Skip to content

Commit 68ff43f

Browse files
author
Guillaume Chau
committed
refactor(vuex): removed state loading progress => now indeterminate
1 parent 247443b commit 68ff43f

File tree

5 files changed

+6
-28
lines changed

5 files changed

+6
-28
lines changed

src/backend/vuex.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,7 @@ export function initVuexBackend (hook, bridge, isLegacy) {
136136
const { state } = parse(snapshot.state, true)
137137
store.replaceState(state)
138138

139-
const total = index - snapshot.index
140-
SharedData.snapshotLoading = {
141-
current: 0,
142-
total
143-
}
144-
let time = Date.now()
139+
SharedData.snapshotLoading = true
145140

146141
// Replay mutations
147142
for (let i = snapshot.index + 1; i <= index; i++) {
@@ -162,15 +157,6 @@ export function initVuexBackend (hook, bridge, isLegacy) {
162157
if (i !== index && i % SharedData.cacheVuexSnapshotsEvery === 0) {
163158
takeSnapshot(i, state)
164159
}
165-
166-
const now = Date.now()
167-
if (now - time <= 100) {
168-
time = now
169-
SharedData.snapshotLoading = {
170-
current: i - snapshot.index,
171-
total
172-
}
173-
}
174160
}
175161

176162
// Send final state after replay

src/devtools/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function initApp (shell) {
155155
}
156156

157157
requestAnimationFrame(() => {
158-
SharedData.snapshotLoading = null
158+
SharedData.snapshotLoading = false
159159
})
160160
})
161161

src/devtools/views/vuex/VuexStateInspector.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@
6565
Loading state...
6666
</div>
6767

68-
<VueLoadingBar
69-
:value="$shared.snapshotLoading.current / $shared.snapshotLoading.total"
70-
/>
68+
<VueLoadingIndicator />
7169
</div>
7270
<div
7371
v-else-if="isOnlyMutationPayload"

src/devtools/views/vuex/actions.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ export function inspect ({ commit, getters }, entryOrIndex) {
5959
if (cached) {
6060
commit('UPDATE_INSPECTED_STATE', cached)
6161
} else {
62-
SharedData.snapshotLoading = {
63-
current: 0,
64-
total: 1
65-
}
62+
SharedData.snapshotLoading = true
6663
commit('UPDATE_INSPECTED_STATE', null)
6764
bridge.send('vuex:inspect-state', mutationIndex)
6865
}
@@ -91,10 +88,7 @@ function travelTo (state, commit, index, apply = true) {
9188
const { inspectedIndex } = state
9289

9390
commit('UPDATE_INSPECTED_STATE', null)
94-
SharedData.snapshotLoading = {
95-
current: 0,
96-
total: 1
97-
}
91+
SharedData.snapshotLoading = true
9892
bridge.send('vuex:travel-to-state', { index, apply })
9993

10094
if (index !== inspectedIndex) {

src/shared-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const internalSharedData = {
99
recordVuex: true,
1010
cacheVuexSnapshotsEvery: 50,
1111
cacheVuexSnapshotsLimit: 10,
12-
snapshotLoading: null,
12+
snapshotLoading: false,
1313
recordPerf: false,
1414
editableProps: false,
1515
logDetected: true

0 commit comments

Comments
 (0)