Skip to content

feat(client): createUploadClient returns { upload, useUpload }#180

Open
abhay-ramesh wants to merge 1 commit intobetafrom
feat/client-use-upload
Open

feat(client): createUploadClient returns { upload, useUpload }#180
abhay-ramesh wants to merge 1 commit intobetafrom
feat/client-use-upload

Conversation

@abhay-ramesh
Copy link
Owner

Summary

createUploadClient now returns { upload, useUpload } instead of just the proxy, so you can define everything once and use it without repeating the router type in every component.

Before

// lib/upload.ts
export const upload = createUploadClient<AppRouter>({ endpoint: '/api/upload' });

// Every component — generic needed every time
const { uploadFiles } = useUpload<AppRouter>('imageUpload');

After

// lib/upload.ts — define once, type baked in
export const { upload, useUpload } = createUploadClient<AppRouter>({ endpoint: '/api/upload' });

// Every component — no generic, route name is still type-safe
const { uploadFiles } = useUpload('imageUpload');

// Proxy style still works too
const { uploadFiles } = upload.imageUpload();

Test plan

  • All 156 tests pass
  • Type-check passes
  • useUpload route name argument is fully type-safe (autocomplete + error on unknown routes)
  • Old upload.routeName() proxy still works unchanged

🤖 Generated with Claude Code

Instead of returning just the route proxy, createUploadClient now
returns an object you can destructure:

  export const { upload, useUpload } = createUploadClient<AppRouter>({
    endpoint: '/api/upload'
  });

  // Component — AppRouter type already baked in, no generic needed
  const { uploadFiles } = useUpload('imageUpload');
  // old proxy style still works too
  const { uploadFiles } = upload.imageUpload();

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Mar 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pushduck Error Error Mar 11, 2026 0:44am

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d45991eb-8afd-4289-8d60-b79e12d11a8b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/client-use-upload

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant