1
0

feat: move from life cycle to data or watcher

- remove from created / mounted
- initialize component services in data
- use immediate watcher where appropriate
- deep watch for route changes
This commit is contained in:
Dominik Pschenitschni
2021-09-08 11:59:38 +02:00
committed by kolaente
parent ebeca48be4
commit f51371bbe0
59 changed files with 246 additions and 376 deletions

View File

@ -25,15 +25,17 @@ export default {
Filters,
},
mounted() {
this.params = this.value
document.addEventListener('click', this.hidePopup)
},
beforeDestroy() {
document.removeEventListener('click', this.hidePopup)
},
watch: {
value(newVal) {
this.$set(this, 'params', newVal)
value: {
handler(value) {
this.params = value
},
immediate: true,
},
visible() {
this.visibleInternal = !this.visibleInternal

View File

@ -234,31 +234,24 @@ export default {
params: DEFAULT_PARAMS,
filters: DEFAULT_FILTERS,
usersService: UserService,
usersService: new UserService(),
foundusers: [],
users: [],
labelQuery: '',
labels: [],
listsService: ListService,
listsService: new ListService(),
foundlists: [],
lists: [],
namespaceService: NamespaceService,
namespaceService: new NamespaceService(),
foundnamespace: [],
namespace: [],
}
},
created() {
this.usersService = new UserService()
this.listsService = new ListService()
this.namespaceService = new NamespaceService()
},
mounted() {
this.params = this.value
this.filters.requireAllFilters = this.params.filter_concat === 'and'
this.prepareFilters()
},
props: {
value: {
@ -266,9 +259,12 @@ export default {
},
},
watch: {
value(newVal) {
this.$set(this, 'params', newVal)
this.prepareFilters()
value: {
handler(value) {
this.params = value
this.prepareFilters()
},
immediate: true,
},
},
computed: {

View File

@ -50,13 +50,11 @@ export default {
},
},
watch: {
list() {
this.loadBackground()
list: {
handler: 'loadBackground',
immediate: true,
},
},
created() {
this.loadBackground()
},
methods: {
loadBackground() {
if (this.list === null || !this.list.backgroundInformation || this.backgroundLoading) {