MuckRock / documentcloud-frontend

DocumentCloud's front end source code - Please report bugs, issues and feature requests to info@documentcloud.org
https://www.documentcloud.org
GNU Affero General Public License v3.0
18 stars 5 forks source link

Delay loading to shrink page size #839

Closed eyeseast closed 3 days ago

eyeseast commented 5 days ago

Fixes #837

Test URL: https://deploy-preview-839.muckcloud.com/documents/20006876-2017-epa-staff-calendars-part2-s/

The issue seems to be that server-side rendering every page in a giant document produces a huge HTML page that's too big for our Lambda workers to push it through.

This PR fixes it, but we should do another pass and see if we can slim down our pages further.

sentry-io[bot] commented 5 days ago

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: src/lib/load/document.ts

Function Unhandled Issue
load SyntaxError: Unexpected token '%', "%PDF-1.4 /doc...
Event Count: 1 Affected Users: 1
load TypeError: Failed to construct 'URL': Invalid URL /documents/25279468-aritzia-inc-q2-2025-mda...
Event Count: 1 Affected Users: 1
📄 File: src/routes/(app)/documents/[id]-[slug]/+page.ts (Click to Expand) | Function | Unhandled Issue | | :------- | :----- | | **`load`** | [**SyntaxError: Unexpected token '%', "%PDF-1.4**](https://muckrock.sentry.io/issues/6062860173/?referrer=github-open-pr-bot) /doc...
`Event Count:` **1** `Affected Users:` **1** | | **`load`** | [**TypeError: Failed to construct 'URL': Invalid URL**](https://muckrock.sentry.io/issues/6062860391/?referrer=github-open-pr-bot) /documents/25279468-aritzia-inc-q2-2025-mda...
`Event Count:` **1** `Affected Users:` **1** |

Did you find this useful? React with a 👍 or 👎

github-actions[bot] commented 5 days ago

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 30.84% 6674 / 21634
🔵 Statements 30.84% 6674 / 21634
🔵 Functions 49.54% 273 / 551
🔵 Branches 75.37% 1007 / 1336
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/lib/components/common/Paginator.svelte 0% 0% 0% 0% 1-144
src/lib/components/forms/Reprocess.svelte 0% 0% 0% 0% 1-166
src/lib/components/inputs/Language.svelte 100% 100% 100% 100%
src/lib/components/layouts/ContentLayout.svelte 0% 0% 0% 0% 1-19
src/lib/components/layouts/DocumentLayout.svelte 0% 0% 0% 0% 1-73
src/lib/components/viewer/Notes.svelte 0% 0% 0% 0% 1-47
src/lib/components/viewer/PDF.svelte 0% 0% 0% 0% 1-917
src/lib/components/viewer/PaginationToolbar.svelte 0% 0% 0% 0% 1-1810
src/lib/components/viewer/Text.svelte 0% 0% 0% 0% 1-42
src/lib/components/viewer/Viewer.svelte 0% 0% 0% 0% 1-108
src/lib/components/viewer/ViewerContext.svelte 0% 0% 0% 0% 1-199
src/lib/load/document.ts 0% 0% 0% 0% 1-39
src/routes/(app)/documents/[id]-[slug]/+page.svelte 0% 0% 0% 0% 1-65
src/routes/(app)/documents/[id]-[slug]/+page.ts 0% 0% 0% 0% 1
src/routes/embed/documents/[id]-[slug]/+page.svelte 0% 0% 0% 0% 1-47
src/routes/embed/documents/[id]-[slug]/+page.ts 0% 0% 0% 0% 1
Generated in workflow #740 for commit 631d8cf by the Vitest Coverage Report Action
netlify[bot] commented 5 days ago

Deploy Preview for documentcloud-frontend ready!

Name Link
Latest commit 631d8cfb5deacbcebdc645a9a25001ea2a16c714
Latest deploy log https://app.netlify.com/sites/documentcloud-frontend/deploys/673b50f31a20430008eef94b
Deploy Preview https://deploy-preview-839.muckcloud.com
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

Lighthouse
1 paths audited
Performance: 55
Accessibility: 85
Best Practices: 92
SEO: 91
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.