Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(island-ui): Update url for pdf worker #16273

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

thordurhhh
Copy link
Member

@thordurhhh thordurhhh commented Oct 4, 2024

What

Update worker url

Why

We need the new version to depend on legacy for browser support.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • Bug Fixes
    • Updated the PDF worker source for improved document processing and rendering in the PdfViewer component.

@thordurhhh thordurhhh added the automerge Merge this PR as soon as all checks pass label Oct 4, 2024
@thordurhhh thordurhhh requested a review from a team as a code owner October 4, 2024 13:44
Copy link
Contributor

coderabbitai bot commented Oct 4, 2024

Walkthrough

The changes in this pull request involve a modification to the PdfViewer component in the PdfViewer.tsx file. Specifically, the useEffect hook has been updated to change the worker source for the PDF.js library from a CDN URL to a new asset location. This adjustment affects the loading mechanism of the PDF worker, while the overall component logic remains intact.

Changes

File Change Summary
libs/island-ui/core/src/lib/PdfViewer/PdfViewer.tsx Updated the worker source URL in the useEffect hook for the PDF.js library.

Possibly related PRs

  • chore: update PDF package #15760: This PR also modifies the worker source for the PDF.js library within the PdfViewer.tsx file, specifically changing the file extension of the worker source URL, indicating a related focus on how the PDF worker is loaded.

Suggested reviewers

  • stjanilofts
  • baering
  • oddsson

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 36.92%. Comparing base (7223702) to head (ee21282).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ibs/island-ui/core/src/lib/PdfViewer/PdfViewer.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16273   +/-   ##
=======================================
  Coverage   36.92%   36.92%           
=======================================
  Files        6781     6781           
  Lines      140031   140031           
  Branches    39816    39816           
=======================================
  Hits        51705    51705           
  Misses      88326    88326           
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
application-api-files 57.91% <ø> (ø)
application-core 71.62% <ø> (+0.32%) ⬆️
application-system-api 41.63% <ø> (ø)
application-template-api-modules 24.38% <ø> (ø)
application-templates-accident-notification 29.44% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.63% <ø> (ø)
application-templates-driving-license 18.63% <ø> (ø)
application-templates-estate 12.33% <0.00%> (ø)
application-templates-example-payment 25.41% <ø> (ø)
application-templates-financial-aid 14.34% <ø> (ø)
application-templates-general-petition 23.68% <ø> (ø)
application-templates-health-insurance 26.62% <ø> (ø)
application-templates-inheritance-report 6.45% <ø> (ø)
application-templates-marriage-conditions 15.23% <ø> (ø)
application-templates-mortgage-certificate 43.96% <ø> (ø)
application-templates-parental-leave 30.15% <ø> (ø)
application-types 6.71% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.29% <0.00%> (ø)
auth-react 22.80% <0.00%> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
contentful-apps 5.57% <ø> (ø)
financial-aid-backend 56.53% <ø> (ø)
financial-aid-shared 19.03% <ø> (ø)
island-ui-core 28.47% <0.00%> (ø)
judicial-system-web 28.11% <0.00%> (ø)
portals-admin-regulations-admin 1.88% <ø> (ø)
portals-core 16.17% <0.00%> (ø)
services-auth-personal-representative 45.52% <ø> (ø)
shared-components 27.68% <0.00%> (ø)
shared-form-fields 31.63% <0.00%> (ø)
web 1.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ibs/island-ui/core/src/lib/PdfViewer/PdfViewer.tsx 5.88% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7223702...ee21282. Read the comment docs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
libs/island-ui/core/src/lib/PdfViewer/PdfViewer.tsx (1)

48-49: LGTM! Consider using an environment variable for the worker URL.

The update to the PDF worker URL aligns with the PR objective and maintains the component's reusability. The use of a CDN (Contentful) for hosting the worker file is a good practice for performance.

Consider using an environment variable for the worker URL to make it easier to update in the future and to keep sensitive information out of the codebase. For example:

pdf.pdfjs.GlobalWorkerOptions.workerSrc = process.env.PDF_WORKER_URL || 'https://assets.ctfassets.net/8k0h54kbe6bj/8dqL0H07pYWZEkXwLtgBp/1c347f9a4f2bb255f78389b42cf40b97/pdf.worker.min.mjs'

This change would improve maintainability and allow for easier configuration across different environments.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7223702 and ee21282.

📒 Files selected for processing (1)
  • libs/island-ui/core/src/lib/PdfViewer/PdfViewer.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/island-ui/core/src/lib/PdfViewer/PdfViewer.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."

@datadog-island-is
Copy link

Datadog Report

All test runs fa6527f 🔗

34 Total Test Services: 0 Failed, 33 Passed
⬆️ Test Sessions change in coverage: 1 increased (+0.21%), 146 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-web 0 0 0 2 0 8.99s 1 no change Link
api 0 0 0 4 0 2.87s 1 no change Link
application-api-files 0 0 0 12 0 6.1s 1 no change Link
application-core 0 0 0 90 0 19.9s 1 increased (+0.21%) Link
application-system-api 0 0 0 120 2 2m 59.36s 1 no change Link
application-template-api-modules 0 0 0 135 0 2m 3.26s 1 no change Link
application-templates-accident-notification 0 0 0 148 0 20.33s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 11.88s 1 no change Link
application-templates-driving-license 0 0 0 13 0 15.1s 1 no change Link
application-templates-example-payment 0 0 0 2 0 10.79s 1 no change Link

@kodiakhq kodiakhq bot merged commit 8c470ef into main Oct 4, 2024
131 checks passed
@kodiakhq kodiakhq bot deleted the island-ui/pdf-viewer-worker-url branch October 4, 2024 13:53
kodiakhq bot added a commit that referenced this pull request Oct 4, 2024
* fix(island-ui): Update url for pdf worker (#16273)

* fix(island-ui): pdf viewer worker url (#16280)

* Update url

* Update url

* Update url

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Nov 15, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants