Skip to content

fix: grab call expression deeper than 2 calls#6489

Merged
juliusmarminge merged 12 commits intotrpc:query-optoins-codemodfrom
barelyhuman:fix/nested-member-expression
Feb 12, 2025
Merged

fix: grab call expression deeper than 2 calls#6489
juliusmarminge merged 12 commits intotrpc:query-optoins-codemodfrom
barelyhuman:fix/nested-member-expression

Conversation

@barelyhuman
Copy link
Copy Markdown
Contributor

moves up the tree to find the actuall call expression and use the correct replace helper

Closes #

🎯 Changes

Backward compatible change to make sure the correct call expression is picked in a nested expression.

Old code picked utils.x.helper() but wouldn't do it for utils.x.y.z.helper(), this fixes that

βœ… Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

moves up the tree to find the actuall call expression and use the correct replace helper
@barelyhuman barelyhuman requested a review from a team as a code owner February 12, 2025 10:14
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 12, 2025

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
www βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Feb 12, 2025 5:39pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 12, 2025

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.

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


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 12, 2025

@barelyhuman is attempting to deploy a commit to the trpc Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 12, 2025

Open in Stackblitz

@trpc/client

npm i https://pkg.pr.new/trpc/trpc/@trpc/client@6489

@trpc/next

npm i https://pkg.pr.new/trpc/trpc/@trpc/next@6489

@trpc/server

npm i https://pkg.pr.new/trpc/trpc/@trpc/server@6489

@trpc/tanstack-react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/tanstack-react-query@6489

@trpc/react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/react-query@6489

@trpc/upgrade

npm i https://pkg.pr.new/trpc/trpc/@trpc/upgrade@6489

commit: d40854a

@KATT KATT requested a review from juliusmarminge February 12, 2025 10:35
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

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

not able to test now, but does this make it pass on the next-prisma-starter example?? πŸ‘€

@barelyhuman
Copy link
Copy Markdown
Contributor Author

not able to test now, but does this make it pass on the next-prisma-starter example?? πŸ‘€

That's the only one I tested it on, I'm going to mark it as draft so I can test the other examples, will do it post day job today so give me a bit.

I'm guessing there's a few similar issues so should be ablel to wrap it up in one PR, if they are different however, I'll raise a different PR

@barelyhuman barelyhuman marked this pull request as draft February 12, 2025 10:52
@barelyhuman
Copy link
Copy Markdown
Contributor Author

@juliusmarminge Before I add more utils for the transformer, any standard / doc on the folder structure or do I just make a lib/utils folder?

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge Before I add more utils for the transformer, any standard / doc on the folder structure or do I just make a lib/utils folder?

do what you feel is right!

@barelyhuman
Copy link
Copy Markdown
Contributor Author

Confirmed, working with all examples, no crashes or warnings

If there's any additional behavior that needs to be added, do let me know

Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you!

You wanna keep working on the provider transform bugs I mentioned here? #6262 (comment)

@barelyhuman
Copy link
Copy Markdown
Contributor Author

Awesome! Thank you!

You wanna keep working on the provider transform bugs I mentioned here? #6262 (comment)

Sure, I don't mind.

query though, wouldn't it be nice to have it as a separate PR ?

@juliusmarminge
Copy link
Copy Markdown
Member

query though, wouldn't it be nice to have it as a separate PR ?

Yea I'll merge this one and you can open a new one :)

@juliusmarminge
Copy link
Copy Markdown
Member

juliusmarminge commented Feb 12, 2025

Awesome! Thank you!

You wanna keep working on the provider transform bugs I mentioned here? #6262 (comment)

Re this: The next-see-chat example is a fairly basic one that I think we should be able to fully migrate by running the CLI, so that's a good test to run and make sure that everything in there transforms correctly and the packages are installed etc etc by running DEV=1 bun run ../../../trpc/packages/upgrade/src/bin/cli.ts --force from examples/next-sse-chat

Most other examples uses @trpc/next which I don't think we should bother trying to auto-migrate for now

@juliusmarminge juliusmarminge merged commit 8dd1b08 into trpc:query-optoins-codemod Feb 12, 2025
37 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants