Skip to content

Commit

Permalink
Fix QR properties assignment
Browse files Browse the repository at this point in the history
If this function launches another coroutine, any value assigned within this function will be null if accessed from outside before the coroutine completes, as the assignment process has not yet finished at the time of access.
  • Loading branch information
FikriMilano committed Dec 4, 2024
1 parent 36caf21 commit 8a61bb1
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,10 @@ constructor(
* This function saves [QuestionnaireResponse] as draft if any of the [QuestionnaireResponse.item]
* has an answer.
*/
fun saveDraftQuestionnaire(
suspend fun saveDraftQuestionnaire(
questionnaireResponse: QuestionnaireResponse,
questionnaireConfig: QuestionnaireConfig,
) {
viewModelScope.launch {
val hasPages = questionnaireResponse.item.any { it.hasItem() }
val questionnaireHasAnswer =
questionnaireResponse.item.any {
Expand Down Expand Up @@ -741,7 +740,6 @@ constructor(
resource = questionnaireResponse,
)
}
}
}

/**
Expand Down

0 comments on commit 8a61bb1

Please sign in to comment.