From 962d07da7fff1576cbf110e50b1d29b80355353a Mon Sep 17 00:00:00 2001 From: Eleazar Resendez Date: Mon, 17 Aug 2026 15:16:59 -0600 Subject: [PATCH 1/3] fix(screen-builder): preserve Web Entry task context --- src/components/task.vue | 15 ++- tests/unit/TaskWebEntryRedirect.spec.js | 171 ++++++++++++++++++++++++ 2 files changed, 183 insertions(+), 3 deletions(-) create mode 100644 tests/unit/TaskWebEntryRedirect.spec.js diff --git a/src/components/task.vue b/src/components/task.vue index 83915b57..c667a45a 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -548,14 +548,16 @@ export default { this.$emit("load-data-task", response); if (response.data.data.length > 0) { let task = response.data.data[0]; - if (task.process_request_id !== this.requestId) { - // Next task is in a subprocess, do a hard redirect + const requiresWebEntryFallback = this.isWebEntry + && task.web_entry_available === false; + if (task.process_request_id !== this.requestId || requiresWebEntryFallback) { + // Cross-request transitions and non-Web Entry tasks require a hard redirect. if (this.redirecting === task.process_request_id) { return; } this.unsubscribeSocketListeners(); this.redirecting = task.process_request_id; - this.$emit('redirect', task.id, true); + this.$emit('redirect', this.isWebEntry ? task : task.id, true); return; } else { this.emitIfTaskCompleted(requestId); @@ -947,6 +949,13 @@ export default { window.location.href = await this.getDestinationUrl(); return; } + + // Web Entry needs the complete task to preserve the target request context. + if (this.isWebEntry) { + await this.loadNextAssignedTask(this.requestId); + return; + } + this.nodeId = nodeId; this.taskId = tokenId; diff --git a/tests/unit/TaskWebEntryRedirect.spec.js b/tests/unit/TaskWebEntryRedirect.spec.js new file mode 100644 index 00000000..4c1ebf79 --- /dev/null +++ b/tests/unit/TaskWebEntryRedirect.spec.js @@ -0,0 +1,171 @@ +const fs = require('fs'); +const path = require('path'); +const vm = require('vm'); + +const componentPath = path.join(process.cwd(), 'src/components/task.vue'); +const source = fs.readFileSync(componentPath, 'utf8'); + +function getComponentOptions() { + const scriptMatch = source.match(/