Skip to content

bug(data): usePolling performs a fetch while paused after deps or interval change #3761

Description

@Tomeshwari-02

Summary

usePolling in packages/data/src/hooks/usePolling.ts supports pause(), but the effect always calls execute() immediately when interval, options.adaptive, or a dependency changes. That immediate execution does not check pausedRef.

Reproduction

  1. Render usePolling(fn, 1000, [dep]).
  2. Call pause().
  3. Re-render with a changed dep or interval.
  4. Observe that n is invoked even though the hook is paused.

Expected behavior

While paused, dependency changes should update the polling configuration without starting a new request until
esume() or an explicit
efresh() call.

Actual behavior

The effect rerun calls execute() unconditionally, so a paused poller can still fire network or system calls.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

assignedIssue claimed by a contributor.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions