From f7e2dc7457f366d9cf4722beccfe6b16467ab435 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 12 Mar 2024 11:47:28 +0100 Subject: [PATCH] Fix: force redrawing the questions in a questionbox to avoid rendering artefacts and unselectable items --- src/UI/Popup/TagRendering/Questionbox.svelte | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/UI/Popup/TagRendering/Questionbox.svelte b/src/UI/Popup/TagRendering/Questionbox.svelte index 5724d872a..4d485c29d 100644 --- a/src/UI/Popup/TagRendering/Questionbox.svelte +++ b/src/UI/Popup/TagRendering/Questionbox.svelte @@ -4,7 +4,7 @@ * The questions can either be shown all at once or one at a time (in which case they can be skipped) */ import TagRenderingConfig from "../../../Models/ThemeConfig/TagRenderingConfig" - import { UIEventSource } from "../../../Logic/UIEventSource" + import { Store, UIEventSource } from "../../../Logic/UIEventSource" import type { Feature } from "geojson" import type { SpecialVisualizationState } from "../../SpecialVisualization" import LayerConfig from "../../../Models/ThemeConfig/LayerConfig" @@ -12,6 +12,7 @@ import Tr from "../../Base/Tr.svelte" import Translations from "../../i18n/Translations.js" import { Utils } from "../../../Utils" + import { onDestroy } from "svelte" export let layer: LayerConfig export let tags: UIEventSource> @@ -67,8 +68,13 @@ }, [skippedQuestions] ) - let firstQuestion = questionsToAsk.map((qta) => qta[0]) - + let firstQuestion: UIEventSource = new UIEventSource() + + onDestroy(questionsToAsk.addCallback(qta => { + firstQuestion.setData(undefined) + firstQuestion.setData(qta[0]) + })) + let answered: number = 0 let skipped: number = 0 @@ -144,7 +150,7 @@ {/each} - {:else} + {:else if $firstQuestion !== undefined}