Skip to content

Commit c20cbd3

Browse files
committed
So for PR enhancer, we can get by with only a MutationObserver.
1 parent 603b314 commit c20cbd3

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/lib/enhancers/github/GitHubPrAppendEnhancer.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,13 @@ export class GitHubPrAppendEnhancer implements CommentEnhancer<GitHubPrAppendSpo
6767
padding: 'var(--base-size-8)',
6868
placeholder: 'Add your comment here...',
6969
})[0]!
70-
console.log('C')
71-
textArea.addEventListener('input', () => {
70+
const listenForEmpty = new MutationObserver(() => {
7271
if (textArea.value === '') {
73-
console.log('input event fired')
7472
instance.updatePreview()
7573
}
7674
})
77-
const observer = new MutationObserver(() => {
78-
if (textArea.value === '') {
79-
console.log('MutationObserver fired')
80-
instance.updatePreview()
81-
}
82-
})
83-
observer.observe(textArea, { attributes: true, characterData: true })
84-
const cleanup = () => {
85-
OverType.instances.delete(overtypeContainer)
86-
;(overtypeContainer as any).overTypeInstance = undefined
87-
}
75+
listenForEmpty.observe(textArea, { attributes: true, characterData: true })
8876
return {
89-
cleanup,
9077
instance,
9178
}
9279
}

0 commit comments

Comments
 (0)