@gmickel/gno 1.30.1 → 1.30.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/browser-extension/artifacts/gno-browser-clipper-v1.30.4.zip +0 -0
- package/browser-extension/artifacts/gno-browser-clipper-v1.30.4.zip.sha256 +1 -0
- package/browser-extension/dist/chunk-627emwpj.js +75 -0
- package/browser-extension/dist/manifest.json +1 -1
- package/browser-extension/dist/preview.html +1 -1
- package/browser-extension/dist/service-worker.js +47 -22
- package/package.json +40 -40
- package/src/converters/adapters/officeparser/adapter.ts +7 -3
- package/src/core/project-profile.ts +2 -2
- package/src/publish/encrypted-export.ts +1 -1
- package/src/serve/public/components/ai-elements/code-block.tsx +28 -10
- package/src/serve/public/components/pdf/PdfPageView.tsx +2 -1
- package/src/serve/public/globals.built.css +2 -2
- package/src/serve/public/hooks/use-pdf-document.ts +13 -41
- package/browser-extension/artifacts/gno-browser-clipper-v1.30.1.zip +0 -0
- package/browser-extension/artifacts/gno-browser-clipper-v1.30.1.zip.sha256 +0 -1
- package/browser-extension/dist/chunk-b2zm0jjd.js +0 -50
|
@@ -47,11 +47,10 @@ type LoadOwnership = {
|
|
|
47
47
|
/**
|
|
48
48
|
* Load a PDF document from a same-origin asset URL.
|
|
49
49
|
*
|
|
50
|
-
* Teardown ownership (I3-04): loadingTask.destroy() owns the transport for
|
|
51
|
-
* load
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* instance, never for rejected/never-loaded attempts.
|
|
50
|
+
* Teardown ownership (I3-04): loadingTask.destroy() owns the transport for the
|
|
51
|
+
* entire load lifecycle. documentDestroy is emitted exactly once per
|
|
52
|
+
* successfully loaded viewer instance, never for rejected/never-loaded
|
|
53
|
+
* attempts.
|
|
55
54
|
*/
|
|
56
55
|
export function usePdfDocument(
|
|
57
56
|
url: string | null,
|
|
@@ -125,29 +124,12 @@ export function usePdfDocument(
|
|
|
125
124
|
|
|
126
125
|
/**
|
|
127
126
|
* Idempotent teardown for this load.
|
|
128
|
-
* -
|
|
129
|
-
* -
|
|
130
|
-
* -
|
|
127
|
+
* - Always destroy the loading task exactly once.
|
|
128
|
+
* - Emit documentDestroy only for a viewer-owned success.
|
|
129
|
+
* - A stale late resolution needs no separate proxy cleanup: the loading
|
|
130
|
+
* task already owns and destroys its transport.
|
|
131
131
|
*/
|
|
132
|
-
const teardown = (
|
|
133
|
-
orphanProxy?: PDFDocumentProxy | null;
|
|
134
|
-
reason: "cleanup" | "stale-orphan";
|
|
135
|
-
}): void => {
|
|
136
|
-
if (ownership.tornDown && !opts?.orphanProxy) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (opts?.orphanProxy && opts.reason === "stale-orphan") {
|
|
141
|
-
// Resolved after we already tore down the load attempt — destroy the
|
|
142
|
-
// orphan proxy only; never emit documentDestroy (never viewer-owned).
|
|
143
|
-
try {
|
|
144
|
-
void opts.orphanProxy.destroy();
|
|
145
|
-
} catch {
|
|
146
|
-
// ignore
|
|
147
|
-
}
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
132
|
+
const teardown = (): void => {
|
|
151
133
|
if (ownership.tornDown) {
|
|
152
134
|
return;
|
|
153
135
|
}
|
|
@@ -157,33 +139,23 @@ export function usePdfDocument(
|
|
|
157
139
|
ownership.viewerDoc = null;
|
|
158
140
|
|
|
159
141
|
if (viewerDoc) {
|
|
160
|
-
// Viewer owned the proxy: destroy it once. Do not also destroy the
|
|
161
|
-
// loading task (that would double-destroy the same transport).
|
|
162
|
-
try {
|
|
163
|
-
void viewerDoc.destroy();
|
|
164
|
-
} catch {
|
|
165
|
-
// ignore
|
|
166
|
-
}
|
|
167
142
|
if (!ownership.destroyMetricEmitted) {
|
|
168
143
|
ownership.destroyMetricEmitted = true;
|
|
169
144
|
metrics.recordDocumentDestroy({ docId: ownership.docId });
|
|
170
145
|
}
|
|
171
|
-
return;
|
|
172
146
|
}
|
|
173
147
|
|
|
174
|
-
// Never handed a proxy to the viewer — loading task owns the transport.
|
|
175
148
|
try {
|
|
176
|
-
void ownership.task.destroy();
|
|
149
|
+
void ownership.task.destroy().catch(() => undefined);
|
|
177
150
|
} catch {
|
|
178
151
|
// ignore
|
|
179
152
|
}
|
|
180
|
-
// No documentDestroy for never-loaded / rejected attempts.
|
|
181
153
|
};
|
|
182
154
|
|
|
183
155
|
loadingTask.promise
|
|
184
156
|
.then(async (pdf) => {
|
|
185
157
|
if (isStale()) {
|
|
186
|
-
teardown(
|
|
158
|
+
teardown();
|
|
187
159
|
return;
|
|
188
160
|
}
|
|
189
161
|
ownership.viewerDoc = pdf;
|
|
@@ -203,14 +175,14 @@ export function usePdfDocument(
|
|
|
203
175
|
setDoc(null);
|
|
204
176
|
setNumPages(0);
|
|
205
177
|
setFirstPageReady(false);
|
|
206
|
-
teardown(
|
|
178
|
+
teardown();
|
|
207
179
|
});
|
|
208
180
|
|
|
209
181
|
return () => {
|
|
210
182
|
if (ownershipRef.current === ownership) {
|
|
211
183
|
ownershipRef.current = null;
|
|
212
184
|
}
|
|
213
|
-
teardown(
|
|
185
|
+
teardown();
|
|
214
186
|
};
|
|
215
187
|
}, [url, retryToken, getDocument, classifyPdfError, getPdfMetrics]);
|
|
216
188
|
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7f28a8daa50eec43dcd95d5af91002a5e25cd87682ff7c99905af8c9f3457b24 gno-browser-clipper-v1.30.1.zip
|