Skip to content

Commit

Permalink
fix: consistently use selectedJson in the TransformModal
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Feb 5, 2024
1 parent db482ea commit ac31a79
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lib/components/modals/TransformModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 })
Expand All @@ -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
Expand All @@ -113,7 +113,7 @@
})
const jsonTransformed = getSelectedQueryLanguage(queryLanguageId).executeQuery(
json,
previewJson,
query,
parser
)
Expand Down Expand Up @@ -202,7 +202,7 @@
onChangeQueryLanguage(newQueryLanguageId)
const newSelectedQueryLanguage = getSelectedQueryLanguage(queryLanguageId)
query = newSelectedQueryLanguage.createQuery(json, queryOptions)
query = newSelectedQueryLanguage.createQuery(selectedJson, queryOptions)
isManual = false
}
</script>
Expand Down

0 comments on commit ac31a79

Please sign in to comment.