From 0997901c933beff607ea626e4bba31bf725a3d08 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Tue, 22 Oct 2024 19:51:22 -0700 Subject: [PATCH] Fixing selects when not yet loaded (#5380) --- .../src/case/priority/CasePrioritySelect.vue | 12 +++++++++--- .../dispatch/src/case/type/CaseTypeSelect.vue | 12 +++++++++--- .../incident/priority/IncidentPrioritySelect.vue | 13 ++++++++++--- .../src/incident/type/IncidentTypeSelect.vue | 12 +++++++++--- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/dispatch/static/dispatch/src/case/priority/CasePrioritySelect.vue b/src/dispatch/static/dispatch/src/case/priority/CasePrioritySelect.vue index fba5cba04eba..ecbc78c6b2dd 100644 --- a/src/dispatch/static/dispatch/src/case/priority/CasePrioritySelect.vue +++ b/src/dispatch/static/dispatch/src/case/priority/CasePrioritySelect.vue @@ -143,9 +143,15 @@ export default { project: { handler(newProject) { if (newProject?.id !== this.lastProjectId) { - this.lastProjectId = newProject?.id - this.resetSelection() - this.fetchData() + // Check if we're moving to a valid project (not null) + if (this.lastProjectId) { + this.lastProjectId = newProject.id + this.resetSelection() + this.fetchData() + } else { + // If new project is null/undefined, just update lastProjectId + this.lastProjectId = null + } } this.validatePriority() }, diff --git a/src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue b/src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue index 34f8df53e7cf..ce9693799055 100644 --- a/src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue +++ b/src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue @@ -172,9 +172,15 @@ export default { project: { handler(newProject) { if (newProject?.id !== this.lastProjectId) { - this.lastProjectId = newProject?.id - this.resetSelection() - this.fetchData() + // Check if we're moving to a valid project (not null) + if (this.lastProjectId) { + this.lastProjectId = newProject.id + this.resetSelection() + this.fetchData() + } else { + // If new project is null/undefined, just update lastProjectId + this.lastProjectId = null + } } this.validateType() }, diff --git a/src/dispatch/static/dispatch/src/incident/priority/IncidentPrioritySelect.vue b/src/dispatch/static/dispatch/src/incident/priority/IncidentPrioritySelect.vue index 08ab2d6e0270..9feb7e5e4353 100644 --- a/src/dispatch/static/dispatch/src/incident/priority/IncidentPrioritySelect.vue +++ b/src/dispatch/static/dispatch/src/incident/priority/IncidentPrioritySelect.vue @@ -133,10 +133,17 @@ export default { project: { handler(newProject) { if (newProject?.id !== this.lastProjectId) { - this.lastProjectId = newProject?.id - this.resetSelection() - this.fetchData() + // Check if we're moving to a valid project (not null) + if (this.lastProjectId) { + this.lastProjectId = newProject.id + this.resetSelection() + this.fetchData() + } else { + // If new project is null/undefined, just update lastProjectId + this.lastProjectId = null + } } + this.validatePriority() }, deep: true, diff --git a/src/dispatch/static/dispatch/src/incident/type/IncidentTypeSelect.vue b/src/dispatch/static/dispatch/src/incident/type/IncidentTypeSelect.vue index e7e8c62c3d51..5040af7002bb 100644 --- a/src/dispatch/static/dispatch/src/incident/type/IncidentTypeSelect.vue +++ b/src/dispatch/static/dispatch/src/incident/type/IncidentTypeSelect.vue @@ -86,9 +86,15 @@ export default { project: { handler(newProject) { if (newProject?.id !== this.lastProjectId) { - this.lastProjectId = newProject?.id - this.clearSelection() - this.fetchData() + // Check if we're moving to a valid project (not null) + if (this.lastProjectId) { + this.lastProjectId = newProject.id + this.resetSelection() + this.fetchData() + } else { + // If new project is null/undefined, just update lastProjectId + this.lastProjectId = null + } } }, },