fix(codegen): include TCondition in React hooks FindManyArgs + add VectorFilter to types.ts#818
Merged
pyramation merged 1 commit intomainfrom Mar 15, 2026
Merged
Conversation
…ctorFilter to types.ts Bug 1: queries.ts passed 3 type args to FindManyArgs (TSelect, TWhere, TOrderBy), but the template defines 4 params: FindManyArgs<TSelect, TWhere, TCondition, TOrderBy>. This caused TOrderBy to land in the TCondition slot, defaulting TOrderBy to never and breaking all hook orderBy params. Fixed by conditionally spreading conditionTypeName between filter and orderBy type args, matching the pattern in model-generator.ts. Bug 2: VectorFilter was generated in ORM input-types-generator.ts but was missing from the React types.ts FILTER_CONFIGS. schema-types.ts imports VectorFilter from types.ts, so the missing export caused build failures. Added 5 regression tests to prevent both bugs from recurring.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(codegen): include TCondition in React hooks FindManyArgs + add VectorFilter to types.ts
Summary
Fixes two codegen bugs in
@constructive-io/graphql-codegenthat caused React SDK build failures:Bug 1 — FindManyArgs type arg mismatch:
queries.tspassed 3 type args toFindManyArgs<TSelect, TWhere, TOrderBy>, but the template defines 4 params:FindManyArgs<TSelect, TWhere, TCondition = never, TOrderBy = never>. This causedTOrderByto silently land in theTConditionslot, defaultingTOrderBytoneverand breaking all hookorderByparams. Fixed by conditionally spreadingconditionTypeNamebetween filter and orderBy args, matching the existing pattern inmodel-generator.ts.Bug 2 — Missing VectorFilter export:
VectorFilterwas generated in the ORM'sinput-types-generator.tsbut was absent from the Reacttypes.tsFILTER_CONFIGS. Sinceschema-types.tsimportsVectorFilterfromtypes.ts, the missing export caused build failures.Added 5 regression tests covering both bugs.
Review & Testing Checklist for Human
FindFirstArgsdoesn't need the same TCondition fix.generateSingleQueryHookdoes NOT destructure or use the newconditionoption. If theFindFirstArgstemplate type also has aTConditionparam, this is a gap. Checkselect-types.tsfor theFindFirstArgssignature.config.codegen?.conditionis a valid config path. The orchestrator (index.ts) readsconfig.codegen?.conditionto determine whether condition types are enabled. If this property doesn't exist on theGraphQLSDKConfigTargettype, it will always default totrue(safe but potentially confusing).pnpm buildat repo root to confirm the full build (includingconstructive-react) passes with these changes.orderByparam actually works at runtime.Notes
pnpm buildat repo root passes (includingconstructive-react).