Skip to content

Commit ffe6af9

Browse files
committed
Let it ripple through the design.
1 parent a37b40f commit ffe6af9

File tree

4 files changed

+27
-73
lines changed

4 files changed

+27
-73
lines changed

src/entrypoints/background.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import type {
2-
CommentEvent,
3-
CommentEventType,
4-
CommentSpot,
1+
import {
2+
type CommentEvent,
3+
type CommentEventType,
4+
type CommentSpot,
5+
DRAFT_STORAGE_UNSUPPORTED,
56
} from "@/lib/enhancer"
67
import { type DraftStats, statsFor } from "@/lib/enhancers/draft-stats"
78
import { logger } from "@/lib/logger"
@@ -51,6 +52,11 @@ export function handleCommentEvent(
5152
return CLOSE_MESSAGE_PORT
5253
}
5354

55+
// Skip storage for spots that don't support draft history
56+
if (message.spot.unique_key === DRAFT_STORAGE_UNSUPPORTED) {
57+
return CLOSE_MESSAGE_PORT
58+
}
59+
5460
switch (message.type) {
5561
case "ENHANCED": {
5662
// track the draft

tests/corpus-fixture.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ vi.mock("overtype", () => {
3030
})
3131

3232
import { describe as baseDescribe, test as baseTest, expect } from "vitest"
33-
import type { StrippedLocation } from "@/lib/enhancer"
33+
import {
34+
DRAFT_STORAGE_UNSUPPORTED,
35+
type StrippedLocation,
36+
} from "@/lib/enhancer"
3437
import { EnhancerRegistry } from "../src/lib/registries"
3538
import type { CORPUS } from "./corpus/_corpus-index"
3639
import { cleanupDOM, setupDOM } from "./corpus-utils"
@@ -94,6 +97,10 @@ export function tableUI() {
9497
const enhanced = enhancers.tryToEnhance(textarea, location)
9598
const forValue = `id=${textarea.id} name=${textarea.name} className=${textarea.className}`
9699
if (enhanced) {
100+
// Skip spots that don't support table display (DRAFT_STORAGE_UNSUPPORTED)
101+
if (enhanced.spot.unique_key === DRAFT_STORAGE_UNSUPPORTED) {
102+
continue
103+
}
97104
uiResults.push({
98105
for: forValue,
99106
title: enhanced.enhancer.tableTitle(enhanced.spot),

tests/lib/enhancers/__snapshots__/gh-detection.test.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ exports[`github detection > gh_issue_edit:should detect correct spots 1`] = `
2323
"spot": {
2424
"isIssue": true,
2525
"type": "GH_EDIT",
26-
"unique_key": "github.com:diffplug/gitcasso:56:edit-body",
26+
"unique_key": "DRAFT_STORAGE_UNSUPPORTED",
2727
},
2828
},
2929
{
@@ -47,15 +47,15 @@ exports[`github detection > gh_issue_edit_multiple:should detect correct spots 1
4747
"spot": {
4848
"isIssue": true,
4949
"type": "GH_EDIT",
50-
"unique_key": "github.com:diffplug/testing-deletable:3:edit-body",
50+
"unique_key": "DRAFT_STORAGE_UNSUPPORTED",
5151
},
5252
},
5353
{
5454
"for": "id=:r8k: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input",
5555
"spot": {
5656
"isIssue": true,
5757
"type": "GH_EDIT",
58-
"unique_key": "github.com:diffplug/testing-deletable:3:edit-body",
58+
"unique_key": "DRAFT_STORAGE_UNSUPPORTED",
5959
},
6060
},
6161
{
@@ -140,7 +140,7 @@ exports[`github detection > gh_pr_edit:should detect correct spots 1`] = `
140140
"spot": {
141141
"isIssue": false,
142142
"type": "GH_EDIT",
143-
"unique_key": "github.com:diffplug/gitcasso:58:edit-body",
143+
"unique_key": "DRAFT_STORAGE_UNSUPPORTED",
144144
},
145145
},
146146
{
@@ -166,7 +166,7 @@ exports[`github detection > gh_pr_edit_multiple:should detect correct spots 1`]
166166
"spot": {
167167
"isIssue": false,
168168
"type": "GH_EDIT",
169-
"unique_key": "github.com:diffplug/testing-deletable:5:edit-body",
169+
"unique_key": "DRAFT_STORAGE_UNSUPPORTED",
170170
},
171171
},
172172
{
@@ -178,7 +178,7 @@ exports[`github detection > gh_pr_edit_multiple:should detect correct spots 1`]
178178
"spot": {
179179
"isIssue": false,
180180
"type": "GH_EDIT",
181-
"unique_key": "github.com:diffplug/testing-deletable:5:edit-body",
181+
"unique_key": "DRAFT_STORAGE_UNSUPPORTED",
182182
},
183183
},
184184
{
@@ -228,7 +228,7 @@ exports[`github detection > gh_project_draft_edit:should detect correct spots 1`
228228
"spot": {
229229
"isIssue": true,
230230
"type": "GH_EDIT",
231-
"unique_key": "github.com:project-draft:129503329:edit-body",
231+
"unique_key": "DRAFT_STORAGE_UNSUPPORTED",
232232
},
233233
},
234234
]
@@ -257,7 +257,7 @@ exports[`github detection > gh_project_issue_edit:should detect correct spots 1`
257257
"spot": {
258258
"isIssue": true,
259259
"type": "GH_EDIT",
260-
"unique_key": "github.com:project-draft:129503239:edit-body",
260+
"unique_key": "DRAFT_STORAGE_UNSUPPORTED",
261261
},
262262
},
263263
{

tests/lib/enhancers/__snapshots__/gh-ui.test.ts.snap

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ exports[`github ui > gh_issue:should render correct UI elements 1`] = `
3030

3131
exports[`github ui > gh_issue_edit:should render correct UI elements 1`] = `
3232
[
33-
{
34-
"for": "id=:rc3: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input",
35-
"title": "N/A",
36-
"upperDecoration": <span>
37-
N/A
38-
</span>,
39-
},
4033
{
4134
"for": "id=:ra7: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
4235
"title": "Description",
@@ -65,20 +58,6 @@ exports[`github ui > gh_issue_edit:should render correct UI elements 1`] = `
6558

6659
exports[`github ui > gh_issue_edit_multiple:should render correct UI elements 1`] = `
6760
[
68-
{
69-
"for": "id=:r76: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
70-
"title": "N/A",
71-
"upperDecoration": <span>
72-
N/A
73-
</span>,
74-
},
75-
{
76-
"for": "id=:r8k: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input",
77-
"title": "N/A",
78-
"upperDecoration": <span>
79-
N/A
80-
</span>,
81-
},
8261
{
8362
"for": "id=:r5b: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
8463
"title": "Description",
@@ -165,13 +144,6 @@ exports[`github ui > gh_pr:should render correct UI elements 1`] = `
165144

166145
exports[`github ui > gh_pr_edit:should render correct UI elements 1`] = `
167146
[
168-
{
169-
"for": "id=issue-3429313834-body name=pull_request[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit js-size-to-fit size-to-fit js-session-resumable CommentBox-input FormControl-textarea js-saved-reply-shortcut-comment-field focus-visible overtype-input",
170-
"title": "N/A",
171-
"upperDecoration": <span>
172-
N/A
173-
</span>,
174-
},
175147
{
176148
"for": "id=new_comment_field name=comment[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit FormControl-textarea CommentBox-input js-size-to-fit size-to-fit js-session-resumable js-saved-reply-shortcut-comment-field overtype-input",
177149
"title": "Feat/expand corpus
@@ -202,20 +174,6 @@ exports[`github ui > gh_pr_edit:should render correct UI elements 1`] = `
202174

203175
exports[`github ui > gh_pr_edit_multiple:should render correct UI elements 1`] = `
204176
[
205-
{
206-
"for": "id=issue-3454672384-body name=pull_request[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit js-size-to-fit size-to-fit js-session-resumable CommentBox-input FormControl-textarea js-saved-reply-shortcut-comment-field overtype-input",
207-
"title": "N/A",
208-
"upperDecoration": <span>
209-
N/A
210-
</span>,
211-
},
212-
{
213-
"for": "id=issuecomment-3335416053-body name=issue_comment[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit js-size-to-fit size-to-fit js-session-resumable CommentBox-input FormControl-textarea js-saved-reply-shortcut-comment-field focus-visible overtype-input",
214-
"title": "N/A",
215-
"upperDecoration": <span>
216-
N/A
217-
</span>,
218-
},
219177
{
220178
"for": "id=new_comment_field name=comment[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit FormControl-textarea CommentBox-input js-size-to-fit size-to-fit js-session-resumable js-saved-reply-shortcut-comment-field overtype-input",
221179
"title": "Update README.md
@@ -274,17 +232,7 @@ exports[`github ui > gh_project:should render correct UI elements 1`] = `[]`;
274232

275233
exports[`github ui > gh_project_draft:should render correct UI elements 1`] = `[]`;
276234

277-
exports[`github ui > gh_project_draft_edit:should render correct UI elements 1`] = `
278-
[
279-
{
280-
"for": "id=:r5a: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
281-
"title": "N/A",
282-
"upperDecoration": <span>
283-
N/A
284-
</span>,
285-
},
286-
]
287-
`;
235+
exports[`github ui > gh_project_draft_edit:should render correct UI elements 1`] = `[]`;
288236

289237
exports[`github ui > gh_project_issue:should render correct UI elements 1`] = `
290238
[
@@ -316,13 +264,6 @@ exports[`github ui > gh_project_issue:should render correct UI elements 1`] = `
316264

317265
exports[`github ui > gh_project_issue_edit:should render correct UI elements 1`] = `
318266
[
319-
{
320-
"for": "id=:rdh: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
321-
"title": "N/A",
322-
"upperDecoration": <span>
323-
N/A
324-
</span>,
325-
},
326267
{
327268
"for": "id=:rbs: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
328269
"title": "what about drafts?",

0 commit comments

Comments
 (0)