Skip to content

openapi-react-query: optimistic updates, smarter invalidation, useQueries, typed select, typed per-status errors #195

Description

@benjamineckstein

Batch D · Priority P2 · pkg openapi-react-query

Lower-priority hook gaps (after queryOptions + infinite query):

  • Optimistic updates — no onMutate/rollback/cancelQueries/setQueryData scaffolding (buildMutationHook, hooks.ts:374-509); auto-invalidate is the only cache strategy.
  • Coarse, cross-resource-blind invalidation — a mutation only invalidates its own primary-resource key; POST/DELETE never invalidate a detail key; no spec-driven cross-resource graph → stale-cache bugs on related resources.
  • No useQueries (dynamic parallel); select transforms lose their return type (data generic fixed to Awaited<ReturnType<...>>).
  • Typed per-status error channel — hooks type the error as bare ApiError with body: unknown; can't narrow on error.status === 422 (depends on the openapi-gen ApiError<S,B> generic issue).
  • Path params hard-typed string; resource grouping by first path segment can mis-bucket nested resources.

Effort: M each.

Source: Opus product review, findings RQ-3 to RQ-10.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions