Skip to content

Commit 0997901

Browse files
authored
Fixing selects when not yet loaded (Netflix#5380)
1 parent 6651c01 commit 0997901

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed

src/dispatch/static/dispatch/src/case/priority/CasePrioritySelect.vue

+9-3
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,15 @@ export default {
143143
project: {
144144
handler(newProject) {
145145
if (newProject?.id !== this.lastProjectId) {
146-
this.lastProjectId = newProject?.id
147-
this.resetSelection()
148-
this.fetchData()
146+
// Check if we're moving to a valid project (not null)
147+
if (this.lastProjectId) {
148+
this.lastProjectId = newProject.id
149+
this.resetSelection()
150+
this.fetchData()
151+
} else {
152+
// If new project is null/undefined, just update lastProjectId
153+
this.lastProjectId = null
154+
}
149155
}
150156
this.validatePriority()
151157
},

src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue

+9-3
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,15 @@ export default {
172172
project: {
173173
handler(newProject) {
174174
if (newProject?.id !== this.lastProjectId) {
175-
this.lastProjectId = newProject?.id
176-
this.resetSelection()
177-
this.fetchData()
175+
// Check if we're moving to a valid project (not null)
176+
if (this.lastProjectId) {
177+
this.lastProjectId = newProject.id
178+
this.resetSelection()
179+
this.fetchData()
180+
} else {
181+
// If new project is null/undefined, just update lastProjectId
182+
this.lastProjectId = null
183+
}
178184
}
179185
this.validateType()
180186
},

src/dispatch/static/dispatch/src/incident/priority/IncidentPrioritySelect.vue

+10-3
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,17 @@ export default {
133133
project: {
134134
handler(newProject) {
135135
if (newProject?.id !== this.lastProjectId) {
136-
this.lastProjectId = newProject?.id
137-
this.resetSelection()
138-
this.fetchData()
136+
// Check if we're moving to a valid project (not null)
137+
if (this.lastProjectId) {
138+
this.lastProjectId = newProject.id
139+
this.resetSelection()
140+
this.fetchData()
141+
} else {
142+
// If new project is null/undefined, just update lastProjectId
143+
this.lastProjectId = null
144+
}
139145
}
146+
140147
this.validatePriority()
141148
},
142149
deep: true,

src/dispatch/static/dispatch/src/incident/type/IncidentTypeSelect.vue

+9-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,15 @@ export default {
8686
project: {
8787
handler(newProject) {
8888
if (newProject?.id !== this.lastProjectId) {
89-
this.lastProjectId = newProject?.id
90-
this.clearSelection()
91-
this.fetchData()
89+
// Check if we're moving to a valid project (not null)
90+
if (this.lastProjectId) {
91+
this.lastProjectId = newProject.id
92+
this.resetSelection()
93+
this.fetchData()
94+
} else {
95+
// If new project is null/undefined, just update lastProjectId
96+
this.lastProjectId = null
97+
}
9298
}
9399
},
94100
},

0 commit comments

Comments
 (0)