Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Aug 9, 2025

No description provided.

Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 9, 2025

📝 Walkthrough

Walkthrough

This change introduces Angular v5 support to the TanStack Query plugin. It adds Angular-specific runtime hooks, extends the generator to handle Angular as a target, updates the build and postbuild scripts for Angular, and adds corresponding tests. The build configuration now includes Angular runtime as an entry point.

Changes

Cohort / File(s) Change Summary
Angular Runtime Integration
packages/plugins/tanstack-query/src/runtime-v5/angular.ts
Introduces a new Angular runtime module exporting hooks for queries and mutations, context providers, and utility functions to integrate Angular with TanStack Query v5.
Generator Angular Support
packages/plugins/tanstack-query/src/generator.ts
Extends the generator to support Angular as a target, including version validation, Angular-specific type imports, context handling, and code generation logic for queries and mutations.
Build and Postbuild Scripts
packages/plugins/tanstack-query/scripts/postbuild.js,
packages/plugins/tanstack-query/tsup-v5.config.ts
Updates the build process to include Angular runtime as an entry point and adds a postbuild replacement step to update Angular package import paths in built files.
Angular Plugin Test
packages/plugins/tanstack-query/tests/plugin.test.ts
Adds a new test case and Angular component source to verify plugin functionality and generated hooks for Angular, paralleling existing tests for other frameworks.
Documentation Update
README.md
Updates the npm download badge to reflect the package name change from "zenstack" to "@zenstackhq/runtime".

Sequence Diagram(s)

sequenceDiagram
    participant AngularComponent
    participant AngularRuntime
    participant TanStackQueryClient
    participant API
    AngularComponent->>AngularRuntime: useModelQuery / useModelMutation(...)
    AngularRuntime->>TanStackQueryClient: injectQuery / injectMutation(...)
    TanStackQueryClient->>API: fetch/mutate data (with constructed query key)
    API-->>TanStackQueryClient: returns data/result
    TanStackQueryClient-->>AngularRuntime: provides query/mutation result
    AngularRuntime-->>AngularComponent: returns hook result (data, status, etc.)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

  • Angular tanstack query #2206: The main PR and the retrieved PR both implement the same Angular integration for the TanStack Query plugin, including identical changes to the postbuild script, generator.ts, runtime-v5/angular.ts, test cases, and build configuration, indicating they are directly related.

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 explain this code block.
  • 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 explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d70bd9b and b5b9efe.

⛔ Files ignored due to path filters (2)
  • packages/plugins/tanstack-query/package.json is excluded by !**/*.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !**/*.yaml
📒 Files selected for processing (5)
  • packages/plugins/tanstack-query/scripts/postbuild.js (1 hunks)
  • packages/plugins/tanstack-query/src/generator.ts (8 hunks)
  • packages/plugins/tanstack-query/src/runtime-v5/angular.ts (1 hunks)
  • packages/plugins/tanstack-query/tests/plugin.test.ts (1 hunks)
  • packages/plugins/tanstack-query/tsup-v5.config.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-test (20.x)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: build-test (20.x)
  • GitHub Check: dependency-review
  • GitHub Check: build-test (20.x)
🔇 Additional comments (13)
packages/plugins/tanstack-query/tsup-v5.config.ts (1)

4-4: LGTM!

The Angular runtime entry point is correctly added to the build configuration, following the same pattern as other framework entries.

packages/plugins/tanstack-query/scripts/postbuild.js (1)

49-54: LGTM!

The Angular package alias replacement follows the established pattern for other frameworks and correctly targets Angular runtime files.

packages/plugins/tanstack-query/tests/plugin.test.ts (1)

331-358: Test coverage looks comprehensive!

The Angular test case properly validates the plugin's Angular integration with appropriate dependencies and component structure using Angular's signal-based patterns.

packages/plugins/tanstack-query/src/generator.ts (5)

24-24: LGTM!

Angular is correctly added to the supported targets array.


44-47: Good version constraint validation!

The check ensures Angular support is limited to v5, preventing potential compatibility issues.


232-232: LGTM!

Angular correctly grouped with React and Vue for mutation type handling, as all three frameworks need the mutateAsync override.


606-610: LGTM!

Angular-specific exports follow the established naming convention for context keys and providers.


674-680: LGTM!

Angular imports correctly reference the v5 package and include all necessary TanStack Query types.

packages/plugins/tanstack-query/src/runtime-v5/angular.ts (5)

32-42: LGTM!

The InjectionToken and provider function correctly implement Angular's dependency injection pattern for context management.


47-58: LGTM!

The context retrieval properly handles optional injection with sensible defaults.


70-90: LGTM!

The query hook correctly integrates with Angular's injectQuery and properly constructs query keys with optimistic update support.


102-124: LGTM!

The infinite query hook properly handles pagination with pageParam and correctly passes the initial page parameter.


138-207: LGTM!

The mutation hook implementation is comprehensive with proper handling of:

  • Different HTTP methods (POST, PUT, DELETE)
  • Request body marshalling for non-DELETE operations
  • Query invalidation and optimistic updates
  • Integration with Angular's QueryClient via injection

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5b9efe and 17ad113.

📒 Files selected for processing (1)
  • README.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

13-13: Images should have alternate text (alt text)

(MD045, no-alt-text)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build-test (20.x)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: build-test (20.x)
  • GitHub Check: build-test (20.x)
  • GitHub Check: dependency-review
  • GitHub Check: OSSAR-Scan
  • GitHub Check: Analyze (javascript-typescript)

@ymc9 ymc9 merged commit d8a90cd into main Aug 9, 2025
14 checks passed
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.

4 participants