Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions browser-extension/src/lib/registries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
this.preparedEnhancers.add(enhancer)
}
const overtype = enhancer.enhance(textarea, spot)
this.handleDelayedValueInjection(overtype)
return { enhancer, overtype, spot, textarea }
}
} catch (error) {
Expand All @@ -78,6 +79,24 @@
return null
}

private handleDelayedValueInjection(overtype: OverTypeInstance): void {
// GitHub sometimes injects textarea content after a delay
// We need to trigger OverType to update its preview after such injections
// https://github.com/diffplug/gitcasso/issues/46
setTimeout(() => {
overtype.updatePreview()

Check failure on line 87 in browser-extension/src/lib/registries.ts

View workflow job for this annotation

GitHub Actions / lint-test-and-build

Unhandled error

TypeError: overtype.updatePreview is not a function ❯ Timeout._onTimeout src/lib/registries.ts:87:16 ❯ listOnTimeout node:internal/timers:588:17 ❯ processTimers node:internal/timers:523:7 This error originated in "tests/lib/enhancers/github.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "gh_new_issue:should create the correct spot object". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.
}, 100)
setTimeout(() => {
overtype.updatePreview()
}, 200)
setTimeout(() => {
overtype.updatePreview()
}, 400)
setTimeout(() => {
overtype.updatePreview()
}, 8000)
}

getEnhancerCount(): number {
return this.enhancers.size
}
Expand Down
Loading