Skip to content

fix(core): refresh resource subscriptions when their inputs change - #7688

Open
hiteshchoudhary738-alt wants to merge 1 commit into
refinedev:mainfrom
hiteshchoudhary738-alt:fix/use-resource-subscription-deps
Open

hiteshchoudhary738-alt wants to merge 1 commit into
refinedev:mainfrom
hiteshchoudhary738-alt:fix/use-resource-subscription-deps

Conversation

@hiteshchoudhary738-alt

Copy link
Copy Markdown

PR Checklist

  • Commit message follows the contribution guidelines.
  • Related issue linked (if applicable).
  • Tests have been added.
  • Docs updated (not required for this change).
  • Changeset added.

What is the current behavior?

Resource subscriptions were not properly refreshed when their input dependencies changed, which could result in stale subscriptions.

What is the new behavior?

Subscriptions now refresh when relevant inputs change. The previous subscription is cleaned up before a new one is created.

Callbacks are stored in refs so that the latest callback is always used without causing unnecessary re-subscriptions.

Also, switching live mode off correctly cleans up the active subscription.

Implementation Details

  • Added dependency tracking for subscription inputs.
  • Used refs to keep callbacks and dynamic values up to date.
  • Added regression tests for dependency changes, cleanup, and callback updates.
  • Added a changeset for @refinedev/core.

Test Results

  • 4 test files passed.
  • 22 tests passed.
  • Biome and Prettier checks passed.

Notes for reviewers

I've added tests covering the main scenarios, including subscription cleanup and avoiding unnecessary re-subscriptions.

Please review the changes and let me know if anything needs improvement.

Thanks!

@changeset-bot

changeset-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e8438c3

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

@hiteshchoudhary738-alt

Copy link
Copy Markdown
Author

Hi maintainers! I've submitted this PR with the implementation, regression tests, and changeset.

The required workflows are currently awaiting approval. Whenever you get a chance, could you please review the changes?

Thanks for your time!

This branch has not been deployed

No deployments
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