-
Notifications
You must be signed in to change notification settings - Fork 346
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: make initOpts optional #1150
Conversation
🦋 Changeset detectedLatest commit: d3bedf0 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 update the uploader functionality in the codebase by making the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Uploader
Caller->>Uploader: Call genUploader(initOpts?)
alt initOpts provided
Uploader->>Uploader: Access provided options with optional chaining
else initOpts undefined
Uploader->>Uploader: Use default values for url and package
end
Uploader-->>Caller: Return uploader instance
Possibly related PRs
Suggested labels
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
Scope: all 3 workspace projects This error happened while installing a direct dependency of /tmp/eslint/packages/uploadthing Packages found in the workspace: ✨ Finishing Touches
🪧 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 (
|
More templates
commit: |
📦 Bundle size comparison
|
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
🧹 Nitpick comments (1)
packages/uploadthing/src/client.ts (1)
264-265
: Consider consolidating default values.The default values for
package
andurl
are duplicated in multiple places. Consider extracting these into constants at the module level.+const DEFAULT_PACKAGE = "uploadthing/client"; + export const genUploader = <TRouter extends FileRouter>( initOpts?: GenerateUploaderOptions, ) => { // ... - package: initOpts?.package ?? "uploadthing/client", + package: initOpts?.package ?? DEFAULT_PACKAGE, // ... - package: initOpts?.package ?? "uploadthing/client", + package: initOpts?.package ?? DEFAULT_PACKAGE,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.changeset/eleven-boxes-fold.md
(1 hunks)packages/uploadthing/src/client.ts
(3 hunks)packages/uploadthing/src/types.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: bundle-analyze-result
- GitHub Check: typecheck
- GitHub Check: lint
- GitHub Check: build
- GitHub Check: e2e-node (backend-adapters)
- GitHub Check: e2e-node (minimal-pagedir)
- GitHub Check: e2e-node (minimal-appdir)
- GitHub Check: build
🔇 Additional comments (4)
packages/uploadthing/src/types.ts (1)
235-235
: LGTM! Type definition aligns with documentation.The change to make
package
optional inGenerateUploaderOptions
correctly reflects its optional nature as suggested in the documentation.packages/uploadthing/src/client.ts (2)
84-86
: LGTM! Function signature updated to match documentation.The change to make
initOpts
optional aligns with the documented behavior.
111-113
: LGTM! Robust default value handling.Good use of the nullish coalescing operator to provide default values while maintaining type safety.
.changeset/eleven-boxes-fold.md (1)
1-5
: LGTM! Clear and accurate changeset.The patch version and description accurately reflect the nature of the changes.
no reason for this to be required and the docs already suggests it's optional
Summary by CodeRabbit
New Features
Bug Fixes