-
-
Notifications
You must be signed in to change notification settings - Fork 38
doc: fix installation instructions for tanstack-query and swr plugins #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe pull request includes significant updates to several documentation files and code components related to building a blogging application using Next.js and Nuxt V3. Key enhancements involve the introduction of user authentication features, including credential-based authentication with NextAuth, detailed project setup instructions, and updates to user and post models. The documentation has been refined for clarity, with new sections added for signup and signin functionalities, as well as improved guidance on managing posts and implementing access policies. Changes
Possibly related PRs
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (5)
docs/quick-start/nextjs.mdx (3)
Line range hint
224-238: Document TanStack Query version compatibilityThe hooks plugin configuration uses 'v5' which corresponds to @tanstack/react-query v5. This version requirement should be documented in the installation section.
Add a note after the installation command:
npm install @zenstackhq/server@latest @zenstackhq/tanstack-query@latest @tanstack/react-query + +> Note: This guide uses TanStack Query v5. If you're using v4, change the `version` in the hooks plugin configuration to 'v4'.
Line range hint
239-308: Improve type safety in error handlingThe signup form uses TypeScript's 'any' type with eslint disable comments. Consider using a proper error type for better type safety.
Replace the error handling with:
- /* eslint-disable @typescript-eslint/no-explicit-any */ - /* eslint-disable @typescript-eslint/no-unsafe-member-access */ + type PrismaError = { + info?: { + prisma: boolean; + code: string; + }; + }; + async function onSignup(e: FormEvent) { e.preventDefault(); try { await signup({ data: { email, password } }); - } catch (err: any) { + } catch (err: unknown) { console.error(err); - if (err.info?.prisma && err.info?.code === "P2002") { + const prismaError = err as PrismaError; + if (prismaError.info?.prisma && prismaError.info?.code === "P2002") {
Line range hint
309-419: Add loading and error states to Posts componentThe Posts component doesn't handle loading or error states from the useFindManyPost hook, which could lead to poor user experience.
Add loading and error handling:
- const { data: posts } = useFindManyPost({ + const { data: posts, isLoading, error } = useFindManyPost({ include: { author: true }, orderBy: { createdAt: "desc" }, }); + if (isLoading) return <div>Loading posts...</div>; + if (error) return <div>Error loading posts: {error.message}</div>; + return ( <div className="container flex flex-col text-white">docs/quick-start/nextjs-app-router.mdx (2)
223-224: Add SWR integration examples if intendedBased on the PR title mentioning SWR plugins, consider adding:
- Alternative hooks plugin configuration for SWR
- Code examples demonstrating SWR integration
- Comparison between Tanstack Query and SWR approaches
223-224: Enhance React Query SSR documentationConsider expanding the SSR documentation section to include:
- Common pitfalls in SSR setup
- Best practices for data prefetching
- Performance optimization tips
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
docs/quick-start/nextjs-app-router.mdx(1 hunks)docs/quick-start/nextjs.mdx(1 hunks)docs/quick-start/nuxt.mdx(1 hunks)docs/reference/plugins/swr.mdx(1 hunks)
🔇 Additional comments (2)
docs/reference/plugins/swr.mdx (1)
26-26: LGTM! Correct update to installation instructions.
The change from npm install --save-dev to npm install is appropriate since @zenstackhq/swr provides runtime hooks that are used in the application code, not just during development.
docs/quick-start/nextjs.mdx (1)
224-224: LGTM! Installation instructions are accurate and complete.
The command correctly includes all necessary dependencies including the peer dependency @tanstack/react-query.
Summary by CodeRabbit
@zenstackhq/swrplugin to reflect dependency changes.