Skip to content

fix(core): keep query context signal lazy when merging meta#7426

Open
jwgmeligmeyling wants to merge 1 commit into
refinedev:mainfrom
athenagroup:fix/lazy-query-context-signal
Open

fix(core): keep query context signal lazy when merging meta#7426
jwgmeligmeyling wants to merge 1 commit into
refinedev:mainfrom
athenagroup:fix/lazy-query-context-signal

Conversation

@jwgmeligmeyling
Copy link
Copy Markdown
Contributor

Summary

This keeps queryContext.signal lazy when merging query context into meta.

Previously we spread prepareQueryContext(context) into a new meta object inside multiple core data hooks. Because signal is defined as a getter, object spread eagerly accessed it during merge. That marks the query as abortable earlier than intended and can trigger the duplicate request behavior described in #7132.

Closes #7132.

Changes

  • update prepareQueryContext to accept an optional meta object and merge into it internally
  • preserve signal as a lazy getter on the returned object
  • switch affected hooks to use the helper directly:
    • useList
    • useOne
    • useMany
    • useInfiniteList
    • useCustom
  • add a regression test for lazy signal access

Validation

  • corepack pnpm --filter @refinedev/devtools-shared --filter @refinedev/devtools-internal build
  • corepack pnpm --dir packages/core test -- src/definitions/helpers/prepare-query-context/index.spec.ts src/hooks/data/useList.spec.tsx src/hooks/data/useOne.spec.tsx src/hooks/data/useMany.spec.tsx src/hooks/data/useCustom.spec.tsx src/hooks/data/useInfiniteList.spec.tsx
  • corepack pnpm --dir packages/core build

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 17, 2026

🦋 Changeset detected

Latest commit: d848100

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@refinedev/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jwgmeligmeyling jwgmeligmeyling changed the title Fix/lazy query context signal fix(core): keep query context signal lazy when merging meta May 17, 2026
@jwgmeligmeyling jwgmeligmeyling force-pushed the fix/lazy-query-context-signal branch from 7ecac9c to d848100 Compare May 18, 2026 18:55
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.

[BUG] React Query double fetching in Refine v5 caused by unintended signal access (v4 did not do this)

2 participants