nextjs - 💡(How to fix) Fix Bug: RTK Query does not refetch when passing dynamic objects in Next.js 16 (React 19) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86421Fetched 2026-04-08 02:11:08
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Timeline (top)
commented ×1issue_type_added ×1subscribed ×1unsubscribed ×1

Code Example

Next.js: 16.0.3
React: 19
TypeScript: Yes
RTK Query: Latest
App Router: Yes
Client Components: Yes
Node package manager: pnpm
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/jsdev-robin/munza-client/blob/v-0.1.2/apps/admin/src/components/site/panel/dashboard/pages/brand/list/BrandList.tsx

To Reproduce

After upgrading to Next.js 16 + React 19, RTK Query no longer refetches when passing object arguments to the query hook from client components.

The exact same code works correctly on Next.js 15.

In Next.js 16, state changes do NOT trigger a new request, even though the values are updated.

Current vs. Expected behavior

When passing dynamic objects to RTK Query hooks, any change in the underlying state (e.g., pagination, filters, sorting, or global search) should trigger a refetch automatically.

Actual Behavior

  • State updates correctly in the component
  • Component re-renders
  • RTK Query does not detect argument changes
  • No refetch occurs
  • isFetching never triggers
  • UI shows stale data
  • This issue only occurs in Next.js 16; it does not happen in Next.js 15.

Next.js 16 client components appear to create unstable object references on each render. This breaks shallow comparison in libraries like RTK Query, SWR, or React Query, preventing them from detecting changes and refetching data.

Provide environment information

Next.js: 16.0.3
React: 19
TypeScript: Yes
RTK Query: Latest
App Router: Yes
Client Components: Yes
Node package manager: pnpm

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

  • This issue affects any library that relies on stable object references for hooks
  • Upgrading from Next.js 15 to 16 triggers this problem
  • Wrapping objects in useMemo temporarily fixes the issue, indicating a referential stability regression in Next.js 16

extent analysis

TL;DR

Wrapping objects passed to RTK Query hooks in useMemo may temporarily fix the refetch issue due to unstable object references in Next.js 16.

Guidance

  • Verify that the issue is indeed caused by unstable object references by checking if wrapping the objects in useMemo fixes the problem.
  • Investigate the useMemo dependency array to ensure it includes all necessary dependencies to trigger a refetch when the state changes.
  • Consider using a library or utility function that provides a stable reference to the object, such as lodash.isEqual or a custom implementation.
  • Check the RTK Query documentation for any known issues or workarounds related to object references and refetching.

Example

import { useMemo } from 'react';
import { useGetBrandsQuery } from '../api';

const fetchArgs = useMemo(() => ({ pagination, filters, sorting, search }), [pagination, filters, sorting, search]);

const { data, isFetching } = useGetBrandsQuery(fetchArgs);

Notes

This issue may affect other libraries that rely on stable object references for hooks, and the solution may need to be adapted for each library. The root cause of the unstable object references in Next.js 16 needs to be investigated further.

Recommendation

Apply workaround: Wrapping objects in useMemo appears to temporarily fix the issue, but a more permanent solution may require changes to Next.js or RTK Query to handle unstable object references.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING