Skip to content

Commit 5671362

Browse files
committed
fix: correct ttl default value and improve title generation logic in unfurler
1 parent c651a78 commit 5671362

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/entrypoints/content/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const inFlightRequests = new Map<string, Promise<unknown>>();
66

77
export const client = async <T>(
88
pathname: `/api/${string}`,
9-
ttl = 3 * 60 * 1000,
9+
ttl = 3 * 60 * 1000 * 0,
1010
): Promise<T> => {
1111
const { apiKey } = await settings.getValue();
1212
if (!apiKey) {

src/entrypoints/content/unfurler.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,23 @@ export const unfurler = async (el: HTMLAnchorElement) => {
1313
const diagram = await client<CacooDiagram>(
1414
`/api/v1/diagrams/${encodeURIComponent(parsed.diagramId)}.json`,
1515
);
16-
const sheet =
17-
parsed.sheetId && diagram.sheets.find((s) => s.uid === parsed.sheetId);
16+
const sheet = diagram.sheets.find((s) => s.uid === parsed.sheetId);
1817

19-
let title = diagram.title;
18+
let title = "";
19+
20+
title += diagram.title;
2021

2122
if (diagram.folderName) {
2223
title = `${diagram.folderName} / ${title}`;
2324
}
2425

26+
if (parsed.shapeId) {
27+
title = `Shape in ${title}`;
28+
}
29+
if (parsed.commentId) {
30+
title = `Comment on ${title}`;
31+
}
32+
2533
title = `[${diagram.organizationName}] ${title}`;
2634

2735
if (sheet) {

0 commit comments

Comments
 (0)