Force refersh of _all_ questions to fix rendering bugs with svelte

This commit is contained in:
Pieter Vander Vennet 2024-03-19 01:53:45 +01:00
parent 2bd1596b60
commit 3daac42853

View file

@ -68,13 +68,19 @@
}, },
[skippedQuestions] [skippedQuestions]
) )
let firstQuestion: UIEventSource<TagRenderingConfig> = new UIEventSource<TagRenderingConfig>() let firstQuestion: UIEventSource<TagRenderingConfig> = new UIEventSource<TagRenderingConfig>(undefined)
let allQuestionsToAsk : UIEventSource<TagRenderingConfig[]> = new UIEventSource<TagRenderingConfig[]>([])
onDestroy(questionsToAsk.addCallback(qta => { onDestroy(questionsToAsk.addCallback(qta => {
firstQuestion.setData(undefined) firstQuestion.setData(undefined)
firstQuestion.setData(qta[0]) firstQuestion.setData(qta[0])
allQuestionsToAsk.setData([])
allQuestionsToAsk.setData(qta)
})) }))
let answered: number = 0 let answered: number = 0
let skipped: number = 0 let skipped: number = 0
@ -98,7 +104,7 @@
class="marker-questionbox-root" class="marker-questionbox-root"
class:hidden={$questionsToAsk.length === 0 && skipped === 0 && answered === 0} class:hidden={$questionsToAsk.length === 0 && skipped === 0 && answered === 0}
> >
{#if $questionsToAsk.length === 0} {#if $allQuestionsToAsk.length === 0}
{#if skipped + answered > 0} {#if skipped + answered > 0}
<div class="thanks"> <div class="thanks">
<Tr t={Translations.t.general.questionBox.done} /> <Tr t={Translations.t.general.questionBox.done} />
@ -146,7 +152,7 @@
<div> <div>
{#if $showAllQuestionsAtOnce} {#if $showAllQuestionsAtOnce}
<div class="flex flex-col gap-y-1"> <div class="flex flex-col gap-y-1">
{#each $questionsToAsk as question (question.id)} {#each $allQuestionsToAsk as question (question.id)}
<TagRenderingQuestion config={question} {tags} {selectedElement} {state} {layer} /> <TagRenderingQuestion config={question} {tags} {selectedElement} {state} {layer} />
{/each} {/each}
</div> </div>