Closed juliusmarminge closed 2 weeks ago
The latest updates on your projects. Learn more about Vercel for Git βοΈ
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
docs-uploadthing | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Nov 5, 2024 9:56pm |
Latest commit: 8e1bcbd8c2c0128661ba53454617ebf501831e6c
The changes in this PR will be included in the next version bump.
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
[!WARNING]
Rate limit exceeded
@juliusmarminge has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 0 seconds before requesting another review.
β How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.π¦ How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.π₯ Commits
Reviewing files that changed from the base of the PR and between 5d0ad5edb8dd3ae15a6fbcf4facbe26ad849c9b3 and 8e1bcbd8c2c0128661ba53454617ebf501831e6c.
This pull request introduces significant changes across multiple files related to upload handling in the uploadthing
package. Key modifications include simplifying property access in various functions by removing unnecessary intermediate objects, updating type definitions to enhance flexibility and clarity, and refining error handling practices. The changes affect how uploadable entities and middleware functions are defined and utilized, ultimately restructuring the internal logic for better maintainability.
File Path | Change Summary |
---|---|
packages/uploadthing/src/internal/error-formatter.ts |
Updated formatError function to access errorFormatter directly from the router object, removing the intermediate _def property. |
packages/uploadthing/src/internal/handler.ts |
Replaced Uploader<AnyParams> with AnyFileRoute in multiple function signatures. Updated handleErrorRequest , handleCallbackRequest , and handleUploadAction to access properties directly on uploadable . Enhanced error handling in the POST request handler. |
packages/uploadthing/src/internal/route-config.ts |
Modified extractRouterConfig function to access routerConfig directly, removing the _def layer. Error handling logic in assertFilesMeetConfig remains unchanged. |
packages/uploadthing/src/internal/types.ts |
Restructured type definitions, including changes to ResolverOptions , MiddlewareFn , and Uploader interface. Introduced UploadCompleteFn and updated inferencing types for better type safety. |
packages/uploadthing/src/internal/upload-builder.ts |
Replaced UploadBuilderDef with AnyFileRoute . Updated internalCreateBuilder to accept Partial<AnyFileRoute> . Adjusted the return type of onUploadComplete method to include the onUploadComplete property. |
packages/uploadthing/test/upload-builder.test.ts |
Updated test cases to reflect changes in property access, removing underscores from routerConfig and middleware . Ensured tests validate error scenarios and maintain type safety throughout. |
packages/expo/src/index.ts |
Modified import statement for FileRouter , changing source from uploadthing/internal/types to uploadthing/types . |
packages/nuxt/src/module.ts |
Modified import statement for RouteHandlerConfig , changing source from uploadthing/internal/types to uploadthing/types . |
packages/uploadthing/src/client.ts |
Added FileRouter and inferEndpointOutput types to imports, enhancing type definitions. |
packages/uploadthing/src/effect-platform.ts |
Updated import statements for FileRouter and RouteHandlerConfig , changing source from ./internal/types to ./types . |
packages/uploadthing/src/express.ts |
Modified import paths for FileRouter and RouteHandlerOptions , changing source from ./internal/types to ./types . |
packages/uploadthing/src/fastify.ts |
Updated import paths for FileRouter and RouteHandlerOptions , changing source from ./internal/types to ./types . |
packages/uploadthing/src/h3.ts |
Changed import paths for FileRouter and RouteHandlerOptions , and adjusted export statements. |
packages/uploadthing/src/next-legacy.ts |
Modified import statement for FileRouter and RouteHandlerOptions , changing source from ./internal/types to ./types . |
packages/uploadthing/src/next.ts |
Updated import paths for FileRouter and RouteHandlerOptions , changing source from ./internal/types to ./types . |
packages/uploadthing/src/remix.ts |
Changed import paths for FileRouter and RouteHandlerOptions , changing source from ./internal/types to ./types . |
packages/uploadthing/src/server.ts |
Modified import paths for FileRouter and RouteHandlerOptions , changing source from ./internal/types to ./types . |
packages/uploadthing/src/types.ts |
Introduced new types and redefined FileRouter , enhancing type safety and flexibility in handling uploads and route configurations. |
getTypeFromFileName
method by allowing it to use the file.type
property as a fallback when the file name does not have an extension, which relates to the handling of file types in the formatError
function.styleFieldArg
to include the files
property, which is relevant to the changes made in the formatError
function regarding how errors are processed and displayed based on file handling.formatError
function, ensuring that types are correctly inferred during transformations.examples
π° In the land of uploads, so bright and fair,
Changes abound, with a hop and a flair.
Error handling's clearer, types now align,
A smoother path for uploads, oh how divine!
With each little tweak, our code takes a leap,
In the burrow of progress, we joyfully leap! π₯β¨
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?
Bundle | Size (gzip) | Visualization |
---|---|---|
Main | 27.51KB | See Treemap π |
PR (f19fb3a3b778ae4b23e62b865027e138dd69220c) | 27.51KB | See Treemap π |
Diff | No change |
- [@example/minimal-appdir](https://pkg.pr.new/template/a4f035ae-023d-48b2-b4bf-d56096c4050e) - [@example/minimal-astro-react](https://pkg.pr.new/template/3027a0ed-2c7f-4c76-aba4-3a969a22f79f) - [@example/minimal-expo](https://pkg.pr.new/template/44679e19-cc12-4df9-9f49-779274809bb6) - [@example/minimal-nuxt](https://pkg.pr.new/template/7a74e832-25e0-4db1-9c50-d36c46a381d8) - [@example/minimal-solidstart](https://pkg.pr.new/template/3be3e35d-9d4b-43cb-a1f6-a7cff808aeae) - [@example/minimal-pagedir](https://pkg.pr.new/template/b9966c02-230e-4519-979c-73391d3839fe) - [@example/minimal-sveltekit](https://pkg.pr.new/template/d5080009-d5f7-46a7-8737-2f3f3f7337fe) - [@example/minimal-tanstack-start](https://pkg.pr.new/template/992f81cd-0660-4d20-b532-7ab98083e4be)
``` pnpm add https://pkg.pr.new/pingdotgg/uploadthing/@uploadthing/expo@1044 ```
``` pnpm add https://pkg.pr.new/pingdotgg/uploadthing/@uploadthing/nuxt@1044 ```
``` pnpm add https://pkg.pr.new/pingdotgg/uploadthing/@uploadthing/react@1044 ```
``` pnpm add https://pkg.pr.new/pingdotgg/uploadthing/@uploadthing/solid@1044 ```
``` pnpm add https://pkg.pr.new/pingdotgg/uploadthing/@uploadthing/svelte@1044 ```
``` pnpm add https://pkg.pr.new/pingdotgg/uploadthing@1044 ```
``` pnpm add https://pkg.pr.new/pingdotgg/uploadthing/@uploadthing/vue@1044 ```
commit: 8e1bcbd
This PR simplifies the types of a built file route making hover much nicer and grokable. The idea is simple, the built uploader (i.e. after calling
.onUploadComplete
) does not need to keep around all the internal types, we just need to expose the types that the client needs for inferenceBefore
Server
Client
After
Server
Client
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Tests