-
Notifications
You must be signed in to change notification settings - Fork 326
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
chore: sync key usage on upload #998
Conversation
🦋 Changeset detectedLatest commit: 5ea847a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
WalkthroughThe changes in this pull request involve the addition of a new import for the Changes
Possibly related PRs
Suggested labels
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (3)
packages/uploadthing/src/internal/upload.server.ts (2)
27-27
: LGTM: Version header added correctly.The new header
x-uploadthing-version
is correctly implemented, allowing for version tracking during uploads. This is valuable for debugging and analytics purposes.Consider adding a brief comment explaining the purpose of this header for future maintainers:
+ // Add version header for tracking and debugging purposes HttpClientRequest.setHeader("x-uploadthing-version", version),
11-11
: Overall impact: Positive addition for version tracking.The changes introduce version tracking for uploads without altering existing functionality. This aligns well with the PR objective of synchronizing key usage on upload and provides valuable information for debugging and analytics.
Consider documenting this new version header in your API documentation, if applicable, to inform consumers of your upload API about this additional metadata.
Also applies to: 27-27
packages/uploadthing/src/internal/upload.browser.ts (1)
30-30
: LGTM: Version header added to XMLHttpRequestThe addition of the "x-uploadthing-version" header is a good practice. It allows the server to identify the client version, which can be useful for debugging and maintaining backwards compatibility.
Consider adding a try-catch block around the
setRequestHeader
call to handle potential errors, although they are unlikely in this case:try { xhr.setRequestHeader("x-uploadthing-version", version); } catch (error) { console.warn("Failed to set x-uploadthing-version header:", error); }This would ensure that the upload process continues even if setting the header fails for any reason.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- packages/uploadthing/src/internal/upload.browser.ts (2 hunks)
- packages/uploadthing/src/internal/upload.server.ts (2 hunks)
🧰 Additional context used
🔇 Additional comments (3)
packages/uploadthing/src/internal/upload.server.ts (1)
11-11
: LGTM: Version import added correctly.The import statement for the
version
frompackage.json
is correctly implemented. This is a good practice for accessing the package version in the code.packages/uploadthing/src/internal/upload.browser.ts (2)
7-7
: LGTM: Version import addedThe addition of the version import from package.json is a good practice. It allows the code to use the current package version, which can be helpful for tracking or debugging purposes.
Line range hint
1-184
: Overall assessment: Changes look goodThe changes made to this file are minimal and well-implemented. They improve version tracking by adding the package version to the upload request headers. This can be valuable for debugging and maintaining backwards compatibility. The changes don't introduce any breaking modifications to the existing functionality.
More templates
commit: |
📦 Bundle size comparison
|
A new canary is available for testing. You can install this latest build in your project with: pnpm add @uploadthing/expo@7.0.3-canary.463ce07
pnpm add @uploadthing/mime-types@0.3.1-canary.463ce07
pnpm add @uploadthing/nuxt@7.0.3-canary.463ce07
pnpm add @uploadthing/react@7.0.3-canary.463ce07
pnpm add @uploadthing/shared@7.0.3-canary.463ce07
pnpm add @uploadthing/solid@7.0.3-canary.463ce07
pnpm add @uploadthing/svelte@7.0.3-canary.463ce07
pnpm add uploadthing@7.0.3-canary.463ce07
pnpm add @uploadthing/vue@7.0.3-canary.463ce07 |
There was a problem hiding this 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)
.changeset/popular-forks-speak.md (1)
5-5
: Minor grammatical improvement suggested.Consider adding the article "the" before "dashboard" for improved readability.
Here's the suggested change:
- chore: send version header when uploading to have accurate version shown on dashboard + chore: send version header when uploading to have accurate version shown on the dashboard🧰 Tools
🪛 LanguageTool
[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: ...ading to have accurate version shown on dashboard(AI_EN_LECTOR_MISSING_DETERMINER_THE)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- .changeset/popular-forks-speak.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
.changeset/popular-forks-speak.md
[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: ...ading to have accurate version shown on dashboard(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🔇 Additional comments (1)
.changeset/popular-forks-speak.md (1)
1-5
: LGTM: Changeset correctly documents the patch update.The changeset file accurately describes the patch update for the "uploadthing" package, which aligns with the PR objectives and the changes summarized in the AI-generated summary.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: ...ading to have accurate version shown on dashboard(AI_EN_LECTOR_MISSING_DETERMINER_THE)
ref: https://discord.com/channels/966627436387266600/1292693436184531061
Summary by CodeRabbit