-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
fix(tanstack,swr): create/upsert hooks shouldn't be generated for delegate models #1567
Conversation
WalkthroughWalkthroughThe recent updates implement checks for delegate models to exclude specific operations like Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SWRPlugin
participant TanstackQueryPlugin
participant Model
User ->> SWRPlugin: Generate SWR hooks
SWRPlugin ->> SWRPlugin: Check if model is a delegate model
alt Delegate Model
SWRPlugin -->> User: Skip create and upsert operations
else Non-Delegate Model
SWRPlugin ->> Model: Generate create and upsert hooks
User -->> Model: Use generated hooks
end
User ->> TanstackQueryPlugin: Generate Tanstack Query hooks
TanstackQueryPlugin ->> TanstackQueryPlugin: Check if model is a delegate model
alt Delegate Model
TanstackQueryPlugin -->> User: Skip create and upsert operations
else Non-Delegate Model
TanstackQueryPlugin ->> Model: Generate create and upsert hooks
User -->> Model: Use generated hooks
end
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- packages/plugins/swr/src/generator.ts (3 hunks)
- packages/plugins/tanstack-query/src/generator.ts (3 hunks)
- tests/integration/tests/enhancements/with-delegate/plugin-interaction.test.ts (1 hunks)
Additional comments not posted (8)
tests/integration/tests/enhancements/with-delegate/plugin-interaction.test.ts (2)
26-40
: LGTM! Ensure schema and dependencies are correct.The
swr
test case is correctly added, defining a schema and loading it with the required dependencies.Verify that the schema and dependencies (
@zenstackhq/swr
andswr
) are correctly configured and available.
49-55
: LGTM! Ensure additional dependencies are correct.The
trpc
test case has been correctly modified to includegenerateClientHelpers = 'react'
and add@trpc/react-query
toextraDependencies
.Verify that the additional dependencies (
@trpc/react-query
) are correctly configured and available.packages/plugins/swr/src/generator.ts (3)
81-85
: LGTM! EnsureisDelegateModel
function is correctly integrated.The
create
operation is correctly excluded for delegate models.Verify that the
isDelegateModel
function is correctly integrated and functioning as expected.
91-91
: LGTM! EnsureisDelegateModel
function is correctly integrated.The
createMany
operation is correctly excluded for delegate models.Verify that the
isDelegateModel
function is correctly integrated and functioning as expected.
144-144
: LGTM! EnsureisDelegateModel
function is correctly integrated.The
upsert
operation is correctly excluded for delegate models.Verify that the
isDelegateModel
function is correctly integrated and functioning as expected.packages/plugins/tanstack-query/src/generator.ts (3)
345-349
: LGTM! EnsureisDelegateModel
function is correctly integrated.The
create
operation is correctly excluded for delegate models.Verify that the
isDelegateModel
function is correctly integrated and functioning as expected.
354-354
: LGTM! EnsureisDelegateModel
function is correctly integrated.The
createMany
operation is correctly excluded for delegate models.Verify that the
isDelegateModel
function is correctly integrated and functioning as expected.
428-428
: LGTM! EnsureisDelegateModel
function is correctly integrated.The
upsert
operation is correctly excluded for delegate models.Verify that the
isDelegateModel
function is correctly integrated and functioning as expected.
No description provided.