Skip to content

Commit

Permalink
🔧 fix: remove duplicate editor rerendering on language change
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Dec 28, 2021
1 parent 7d0e18a commit 91ca66a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/components/editor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
updateEditor(body, language, {
overwrite: requestEditorChange
})
requestEditorChange = false
})
controller.subscribe(({ index }) => {
if(index === prevIndex) return
console.log(index, prevIndex)
requestEditorChange = true
})
Expand All @@ -45,10 +44,8 @@
let body = editor.getValue()
let language = detectLanguage(body)
if (language !== $fetchStorage.language) {
if (language !== $fetchStorage.language)
$fetchStorage.language = language
updateEditor(body, language)
}
}, 100) as unknown as number
})
Expand Down

0 comments on commit 91ca66a

Please sign in to comment.