Skip to content

Commit cb53903

Browse files
committed
Remove the infrastructure for prepareForFirstEnhancement()
1 parent 180b684 commit cb53903

File tree

3 files changed

+0
-13
lines changed

3 files changed

+0
-13
lines changed

src/lib/enhancer.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,8 @@ export interface CommentEnhancer<Spot extends CommentSpot = CommentSpot> {
3737
* If we return non-null, then we become the handler for that text area.
3838
*/
3939
tryToEnhance(textarea: HTMLTextAreaElement, location: StrippedLocation): Spot | null
40-
/** This gets called the first time that `tryToEnhance` returns non-null. */
41-
prepareForFirstEnhancement(): void
4240
/**
4341
* If `tryToEnhance` returns non-null, then this gets called.
44-
* It is guaranteed that `prepareForFirstEnhancement` has been called
45-
* exactly once since pageload before this gets called.
4642
*/
4743
enhance(textarea: HTMLTextAreaElement, spot: Spot): OverTypeInstance
4844
/** Returns a ReactNode which will be displayed in the table row. */

src/lib/enhancers/CommentEnhancerMissing.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ export class CommentEnhancerMissing implements CommentEnhancer {
4343
tryToEnhance(_textarea: HTMLTextAreaElement, _location: StrippedLocation): CommentSpot | null {
4444
throw new Error('Method not implemented.')
4545
}
46-
prepareForFirstEnhancement(): void {
47-
throw new Error('Method not implemented.')
48-
}
4946
enhance(_textarea: HTMLTextAreaElement, _spot: CommentSpot): OverTypeInstance {
5047
throw new Error('Method not implemented.')
5148
}

src/lib/registries.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export interface EnhancedTextarea<T extends CommentSpot = CommentSpot> {
1717

1818
export class EnhancerRegistry {
1919
private enhancers = new Set<CommentEnhancer>()
20-
private preparedEnhancers = new Set<CommentEnhancer>()
2120
byType = new Map<string, CommentEnhancer>()
2221

2322
constructor() {
@@ -66,11 +65,6 @@ export class EnhancerRegistry {
6665
try {
6766
const spot = enhancer.tryToEnhance(textarea, location)
6867
if (spot) {
69-
// Prepare enhancer on first use
70-
if (!this.preparedEnhancers.has(enhancer)) {
71-
enhancer.prepareForFirstEnhancement()
72-
this.preparedEnhancers.add(enhancer)
73-
}
7468
const overtype = enhancer.enhance(textarea, spot)
7569
this.handleDelayedValueInjection(overtype)
7670
return { enhancer, overtype, spot, textarea }

0 commit comments

Comments
 (0)