Skip to content

Conversation

@ScriptType
Copy link
Contributor

@ScriptType ScriptType commented Aug 11, 2025

adds docs for zenstackhq/zenstack#2206

Summary by CodeRabbit

  • Documentation
    • Added Angular as a supported target in the TanStack Query docs.
    • Added Angular-specific setup and DI configuration, usage examples for CRUD, reactive filtered queries, and infinite queries.
    • Updated compatibility notes indicating Angular supports only v5.
    • Integrated Angular examples alongside React, Vue, and Svelte tabs.
    • No runtime or API changes.

@vercel
Copy link

vercel bot commented Aug 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
zenstack-new-site Ready Preview 💬 Add feedback Aug 12, 2025 6:45am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Walkthrough

Adds Angular as a documented target in the tanstack-query reference: updates the targets table to note Angular v5 support and inserts Angular-specific examples (DI setup, component usage, reactive filtering, and infinite queries) into existing Tabs alongside React/Vue/Svelte. Documentation-only changes.

Changes

Cohort / File(s) Summary of Changes
Docs: TanStack Query Angular additions
docs/reference/plugins/tanstack-query.mdx
Added Angular to the targets table (note: supports v5 only). Inserted Angular examples across Tabs: app.config.ts DI using provideTanStackQuery and provideAngularQueryContext with a custom fetch; PostsComponent examples demonstrating useFindManyPost, useCreatePost, a reactive filteredPosts variant; and useInfiniteFindManyPost infinite-query example. All additions are documentation-only and placed alongside existing React/Vue/Svelte examples.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

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

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.
  • 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 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/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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: 4

🔭 Outside diff range comments (1)
docs/reference/plugins/tanstack-query.mdx (1)

462-496: Vue example: missing create hook and mismatched handler name

  • create is used but never defined.
  • The template calls onCreatePost but the function is named onCreate.
 <script setup lang="ts">
 import { useFindManyPost, useCreatePost } from '@/lib/hooks';
 
 const props = defineProps({
     userId: String
 });
 
 // list all posts that're visible to the current user, together with their authors
 const { data: posts } = useFindManyPost({
     include: { author: true },
     orderBy: { createdAt: 'desc' },
 });
 
-const onCreate = () => {
+const create = useCreatePost();
+
+const onCreatePost = () => {
     create.mutate({
         data: {
             title: 'My awesome post',
             authorId: userId,
         }
     });
 };
 </script>
 
 <template>
     <div>
-        <button @click="onCreatePost">Create</button>
+        <button @click="onCreatePost">Create</button>
         <ul v-if="posts">
             <li v-for="post in posts" :key="post.id">
                 {{ post.title }} by {{ post.author.email }}
             </li>
         </ul>
     </div>
 </template>
🧹 Nitpick comments (1)
docs/reference/plugins/tanstack-query.mdx (1)

376-411: Angular App Setup tab: code block title doesn’t match contents

This snippet configures application-level providers; the title should be app.config.ts (not a component).

-```typescript title='src/app/posts/posts.component.ts'
+```typescript title='src/app/app.config.ts'
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 98b54c0 and f1cef38.

📒 Files selected for processing (1)
  • docs/reference/plugins/tanstack-query.mdx (5 hunks)
🔇 Additional comments (2)
docs/reference/plugins/tanstack-query.mdx (2)

548-549: No action needed

Closing TabItem for Svelte was added as part of tab restructuring; nothing to change.


186-214: Add missing ApplicationConfig import, align endpoint, and verify path alias

The app.config.ts snippet needs a couple of fixes to match the surrounding examples and ensure it compiles as shown:

  • Import ApplicationConfig from @angular/core at the top of the snippet.
  • Change the endpoint to the default '/api/model' for consistency with other examples.
  • Double-check that your project’s tsconfig.json defines the @/lib/* path alias; if not, switch the hook import to a relative path (e.g. ../../lib/hooks).
```typescript title='app.config.ts'
-import {
+import {
   provideTanStackQuery,
   QueryClient,
 } from '@tanstack/angular-query-experimental';
+import { ApplicationConfig } from '@angular/core';
 import { provideAngularQueryContext } from '@/lib/hooks';
 import type { FetchFn } from '@zenstackhq/tanstack-query/runtime';

 // ...

 export const appConfig: ApplicationConfig = {
   providers: [
     provideTanStackQuery(new QueryClient()),
     provideAngularQueryContext({
-      endpoint: 'http://localhost:3000/v1/api/rpc',
+      endpoint: '/api/model',
       fetch: myFetch,
       logging: true,
     }),
   ],
 };

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

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

♻️ Duplicate comments (4)
docs/reference/plugins/tanstack-query.mdx (4)

19-25: Align intro/install guidance with Angular v5-only requirement

Intro looks good, but the install sentence is now misleading for Angular (v5-only). Update it to avoid implying v4 works for Angular.

- To use the generated hooks, you need to install "tanstack-query" for the target framework with version 4.0.0 or above.
+ To use the generated hooks, install the framework-specific TanStack Query package for v4 or v5 as appropriate. Angular requires v5.

380-410: Fix file title and import path in Angular App Setup example

The snippet is an application configuration, not a component. Also align the hooks import path with earlier sections (use a relative path unless you’ve documented the alias).

-```typescript title='src/app/posts/posts.component.ts'
+```typescript title='app.config.ts'
@@
-import { provideAngularQueryContext } from '@/lib/hooks';
+import { provideAngularQueryContext } from '../lib/hooks';

If you intend to demonstrate additional providers (router, error listeners, zoneless CD), keep them; otherwise, consider trimming to the minimum to stay focused on TanStack Query setup.


844-845: Point to Angular v5 “Guides” page for infinite queries

Link to the Angular v5 guide rather than an examples subpage for broader context.

-Here's a quick example of using infinite query to load a list of posts with infinite pagination. See [Tanstack Query documentation](https://tanstack.com/query/v5/docs/framework/angular/examples/infinite-query-with-max-pages) for more details.
+Here's a quick example of using infinite query to load a list of posts with infinite pagination. See [Angular Infinite Queries guide (TanStack Query v5)](https://tanstack.com/query/v5/docs/framework/angular/guides/infinite-queries) for more details.

551-633: Angular PostsComponent: fix hooks import path and tidy comment

  • Switch to the same import path used elsewhere (relative or documented alias).
  • Minor comment polish.
-import { useCreatePost, useFindManyPost } from '@lib/hooks/generatedAPI';
+import { useCreatePost, useFindManyPost } from '../lib/hooks';
@@
-  //For Reactivity in angular we have to pass the signal as callback
+  // For reactivity in Angular we pass the computed signal via a callback

If your project actually exposes the hooks at a different path (e.g., '@/lib/hooks'), ensure the alias is declared in tsconfig and use it consistently across the docs.

🧹 Nitpick comments (1)
docs/reference/plugins/tanstack-query.mdx (1)

37-38: Nit: punctuation and consistency in options table

The wording is good; add a period at the end for consistency with other sentences.

-| version  | String  | Version of TanStack Query to generate for. Choose from "v4" and "v5". Angular supports only "v5"                    | No      | v5      |
+| version  | String  | Version of TanStack Query to generate for. Choose from "v4" and "v5". Angular supports only "v5".                   | No      | v5      |
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f1cef38 and 0801fc5.

📒 Files selected for processing (1)
  • docs/reference/plugins/tanstack-query.mdx (6 hunks)
🔇 Additional comments (1)
docs/reference/plugins/tanstack-query.mdx (1)

890-901: Good fix: spreading computed value in getNextPageParam

Using ...this.fetchArgs() (instead of the signal function) avoids spreading a function object. LGTM.

@ymc9 ymc9 merged commit b28a2d2 into zenstackhq:main Aug 15, 2025
4 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.

2 participants