-
Notifications
You must be signed in to change notification settings - Fork 856
fix: docs: 140-shared-extensions.mdx: fix example #6966
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
|
Hello. If you can resolve these conflicts, I would be happy to review the changes. |
|
@jlecordier thanks for raising this. Would you be able to resolve the merge conflicts? If not we will close this PR and resolve a fix from our side. |
WalkthroughReplaces an inline extension-on-construction example with a two-step pattern: instantiate Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant PrismaClient as PrismaClient
participant xprisma as Extended Client
Note over Dev,PrismaClient: Previous flow — extension applied at construction
Dev->>PrismaClient: new PrismaClient({ extensions: [findOrCreate] })
PrismaClient-->>Dev: prisma
Dev->>PrismaClient: prisma.user.findOrCreate()
rect rgba(220,255,220,0.25)
Note over Dev,xprisma: New flow — separate extended client via $extends
Dev->>PrismaClient: const prisma = new PrismaClient()
Dev->>xprisma: const xprisma = prisma.$extends(findOrCreate)
xprisma-->>Dev: xprisma
Dev->>xprisma: xprisma.user.findOrCreate()
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
wtf happened lol, I guess I should have let you do it |
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: 1
🧹 Nitpick comments (1)
content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx (1)
35-36: Optional: hint thatawaitrequires an async context.A tiny comment helps readers avoid “await is only valid in async functions” errors when trying the snippet.
Apply this diff:
const xprisma = prisma.$extends(findOrCreate) -const user = await xprisma.user.findOrCreate() +// inside an async function or top-level await environment +const user = await xprisma.user.findOrCreate()
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx(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). (2)
- GitHub Check: runner / linkspector
- GitHub Check: runner / linkspector
🔇 Additional comments (2)
content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx (2)
33-36: Good correction: use an extended client instance (immutability of $extends).Switching to
const xprisma = prisma.$extends(findOrCreate)and invokingxprisma.user.findOrCreate()correctly reflects that$extendsreturns a new client and does not mutate the original instance.
38-38: Clarification reads well.The note correctly explains why
xprisma.user.findOrCreateworks whileprisma.user.findOrCreatedoes not. Nice.
content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx
Show resolved
Hide resolved
content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx
Outdated
Show resolved
Hide resolved
…ared-extensions/index.mdx
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx(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). (2)
- GitHub Check: Check internal links
- GitHub Check: runner / linkspector
🔇 Additional comments (1)
content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx (1)
38-38: Nice clarification about using the extended client (xprisma).This makes the distinction from the base
prismaclear.
The description of the example did not match the example
Summary by CodeRabbit