Commit 4e0163e
committed
fix(query): skip set/get-query-data helpers under hook-shaped queryOptions mutator
When `queryOptions` is a hook-based mutator the query hook caches under a
mutated queryKey, but the generated `useSet*QueryData` / `useGet*QueryData`
helpers cannot legally call that hook to recover the key. Emitting them
would silently target a different cache slot than the query hook writes to.
Skip generation of those helpers when `queryOptionsMutator.isHook` is true
and surface a warning so the misconfiguration is visible. `invalidate` is
left unchanged for backwards compatibility (same gap, pre-existing).
Also pin the `allowUndefinedParam` → `wrapPropsBodyWithMutatorBodyType`
composition with a unit test that exercises the optional-body pipeline used
by `set*QueryData`.
Addresses CodeRabbit review feedback on #33631 parent b5e5bdc commit 4e0163e
2 files changed
Lines changed: 40 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
340 | 358 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
719 | | - | |
720 | | - | |
721 | | - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
722 | 723 | | |
723 | 724 | | |
724 | 725 | | |
| |||
728 | 729 | | |
729 | 730 | | |
730 | 731 | | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
731 | 746 | | |
732 | 747 | | |
733 | 748 | | |
734 | 749 | | |
735 | 750 | | |
736 | 751 | | |
737 | | - | |
| 752 | + | |
| 753 | + | |
738 | 754 | | |
739 | 755 | | |
740 | 756 | | |
| |||
756 | 772 | | |
757 | 773 | | |
758 | 774 | | |
759 | | - | |
| 775 | + | |
| 776 | + | |
760 | 777 | | |
761 | 778 | | |
762 | 779 | | |
| |||
0 commit comments