From ac31a7980d77eae3c5ff3eef0d932f4b3362bdca Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Mon, 5 Feb 2024 16:32:45 +0100 Subject: [PATCH] fix: consistently use selectedJson in the TransformModal --- src/lib/components/modals/TransformModal.svelte | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/components/modals/TransformModal.svelte b/src/lib/components/modals/TransformModal.svelte index 3b272897..24e621f2 100644 --- a/src/lib/components/modals/TransformModal.svelte +++ b/src/lib/components/modals/TransformModal.svelte @@ -76,7 +76,7 @@ let query = queryLanguageId === state.queryLanguageId && state.query ? state.query - : getSelectedQueryLanguage(queryLanguageId).createQuery(json, state.queryOptions || {}) + : getSelectedQueryLanguage(queryLanguageId).createQuery(selectedJson, state.queryOptions || {}) let isManual = state.isManual || false let previewError: string | undefined = undefined @@ -88,7 +88,7 @@ function updateQueryByWizard(newQueryOptions: QueryLanguageOptions) { queryOptions = newQueryOptions - query = getSelectedQueryLanguage(queryLanguageId).createQuery(json, newQueryOptions) + query = getSelectedQueryLanguage(queryLanguageId).createQuery(selectedJson, newQueryOptions) isManual = false debug('updateQueryByWizard', { queryOptions, query, isManual }) @@ -100,8 +100,8 @@ debug('handleChangeQuery', { query, isManual }) } - function previewTransform(json: unknown | undefined, query: string) { - if (json === undefined) { + function previewTransform(previewJson: unknown | undefined, query: string) { + if (previewJson === undefined) { previewContent = { text: '' } previewError = 'Error: No JSON' return @@ -113,7 +113,7 @@ }) const jsonTransformed = getSelectedQueryLanguage(queryLanguageId).executeQuery( - json, + previewJson, query, parser ) @@ -202,7 +202,7 @@ onChangeQueryLanguage(newQueryLanguageId) const newSelectedQueryLanguage = getSelectedQueryLanguage(queryLanguageId) - query = newSelectedQueryLanguage.createQuery(json, queryOptions) + query = newSelectedQueryLanguage.createQuery(selectedJson, queryOptions) isManual = false }