Skip to content

Commit

Permalink
Clear frozenUids and reset focusMode on namespace change (gardene…
Browse files Browse the repository at this point in the history
…r#1915)

* clear forzenUids nd reset focus mode on namespace change

* fault tolerant shoot list
  • Loading branch information
holgerkoser authored Jun 12, 2024
1 parent 8a7cca0 commit c279ce4
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions frontend/src/store/shoot/shoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,20 @@ const useShootStore = defineStore('shoot', () => {

// getters
const shootList = computed(() => {
if (state.focusMode) {
// When state is freezed, do not include new items
return state.froozenUids.map(uid => {
const object = state.shoots[uid] ?? state.staleShoots[uid]
return assignShootInfo(object)
})
const uids = state.focusMode
? state.froozenUids
: activeUids.value
const getShoot = state.focusMode
? uid => state.shoots[uid] ?? state.staleShoots[uid]
: uid => state.shoots[uid]
const items = []
for (const uid of uids) {
const object = getShoot(uid)
if (object) {
items.push(assignShootInfo(object))
}
}
return activeUids.value.map(uid => {
const object = state.shoots[uid]
return assignShootInfo(object)
})
return items
})

const selectedShoot = computed(() => {
Expand Down Expand Up @@ -208,6 +211,8 @@ const useShootStore = defineStore('shoot', () => {
state.shoots = {}
state.shootInfos = {}
state.staleShoots = {}
state.froozenUids = []
state.focusMode = false
})
shootEvents.clear()
ticketStore.clearIssues()
Expand Down

0 comments on commit c279ce4

Please sign in to comment.