Skip to content

fix(codegen): include TCondition in React hooks FindManyArgs + add VectorFilter to types.ts#818

Merged
pyramation merged 1 commit intomainfrom
devin/1773538794-fix-react-codegen-bugs
Mar 15, 2026
Merged

fix(codegen): include TCondition in React hooks FindManyArgs + add VectorFilter to types.ts#818
pyramation merged 1 commit intomainfrom
devin/1773538794-fix-react-codegen-bugs

Conversation

@pyramation
Copy link
Contributor

fix(codegen): include TCondition in React hooks FindManyArgs + add VectorFilter to types.ts

Summary

Fixes two codegen bugs in @constructive-io/graphql-codegen that caused React SDK build failures:

Bug 1 — FindManyArgs type arg mismatch: queries.ts passed 3 type args to FindManyArgs<TSelect, TWhere, TOrderBy>, but the template defines 4 params: FindManyArgs<TSelect, TWhere, TCondition = never, TOrderBy = never>. This caused TOrderBy to silently land in the TCondition slot, defaulting TOrderBy to never and breaking all hook orderBy params. Fixed by conditionally spreading conditionTypeName between filter and orderBy args, matching the existing pattern in model-generator.ts.

Bug 2 — Missing VectorFilter export: VectorFilter was generated in the ORM's input-types-generator.ts but was absent from the React types.ts FILTER_CONFIGS. Since schema-types.ts imports VectorFilter from types.ts, the missing export caused build failures.

Added 5 regression tests covering both bugs.

Review & Testing Checklist for Human

  • Verify FindFirstArgs doesn't need the same TCondition fix. generateSingleQueryHook does NOT destructure or use the new condition option. If the FindFirstArgs template type also has a TCondition param, this is a gap. Check select-types.ts for the FindFirstArgs signature.
  • Verify config.codegen?.condition is a valid config path. The orchestrator (index.ts) reads config.codegen?.condition to determine whether condition types are enabled. If this property doesn't exist on the GraphQLSDKConfigTarget type, it will always default to true (safe but potentially confusing).
  • Run pnpm build at repo root to confirm the full build (including constructive-react) passes with these changes.
  • Regenerate a real SDK against a live schema to verify the generated hooks compile and the orderBy param actually works at runtime.

Notes

  • All 320 existing tests pass, all 124 snapshots updated/passing.
  • Full pnpm build at repo root passes (including constructive-react).
  • Requested by @pyramation
  • Link to Devin Session

…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.
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 47c9c25 into main Mar 15, 2026
44 checks passed
@pyramation pyramation deleted the devin/1773538794-fix-react-codegen-bugs branch March 15, 2026 02:04
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.

1 participant