Skip to content

Commit

Permalink
cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewBemis committed Feb 27, 2025
1 parent c15bde6 commit 0ea37ce
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ui-core/src/components/forms/PagedSurveyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ export function PagedSurveyView({
})
}

const updateTaskId = (response: HubResponse) => {
//TODO: can we trust that the first task returned is the newest? hmmm
const newestTask = response.tasks[0]
const updateTaskId = (hubResponse: HubResponse) => {
const surveyResponseId = hubResponse.response.id
const taskForResponse = hubResponse.tasks.find(task => task.surveyResponseId === surveyResponseId)
//set url params to the newest task id
if (newestTask && taskId !== newestTask.id) {
setTaskId(newestTask.id)
if (taskForResponse && taskId !== taskForResponse.id) {
setTaskId(taskForResponse.id)
}
}

Expand Down

0 comments on commit 0ea37ce

Please sign in to comment.