File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/app-frontend/src Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 165
165
</template >
166
166
167
167
<script >
168
- import { mapState } from ' vuex'
168
+ import { mapState , mapGetters } from ' vuex'
169
169
import { SPECIAL_TOKENS } from ' @utils/util'
170
170
import Keyboard from ' @front/mixins/keyboard'
171
171
import GroupDropdown from ' @front/components/GroupDropdown.vue'
@@ -238,6 +238,10 @@ export default {
238
238
view : state => state .view
239
239
}),
240
240
241
+ ... mapGetters (' components' , {
242
+ totalComponentCount: ' totalCount'
243
+ }),
244
+
241
245
specialTokens () {
242
246
return SPECIAL_TOKENS
243
247
},
@@ -274,10 +278,12 @@ export default {
274
278
this .mediaQuery = window .matchMedia (' (min-width: 685px)' )
275
279
this .switchView (this .mediaQuery )
276
280
this .mediaQuery .addListener (this .switchView )
281
+ this .autoRefreshTimer = setInterval (this .shouldAutoRefresh , 1000 )
277
282
},
278
283
279
284
destroyed () {
280
285
this .mediaQuery .removeListener (this .switchView )
286
+ clearInterval (this .autoRefreshTimer )
281
287
},
282
288
283
289
methods: {
@@ -291,6 +297,12 @@ export default {
291
297
})
292
298
},
293
299
300
+ shouldAutoRefresh () {
301
+ if (this .totalComponentCount === 0 ) {
302
+ this .refresh ()
303
+ }
304
+ },
305
+
294
306
switchView (mediaQueryEvent ) {
295
307
this .$store .commit (
296
308
' SWITCH_VIEW' ,
You can’t perform that action at this time.
0 commit comments