Skip to content

chore: Clear timer functions do noting when a timer does not exist#55126

Closed
retyui wants to merge 3 commits intofacebook:mainfrom
retyui:chore/retyui/ts-clearTimer
Closed

chore: Clear timer functions do noting when a timer does not exist#55126
retyui wants to merge 3 commits intofacebook:mainfrom
retyui:chore/retyui/ts-clearTimer

Conversation

@retyui
Copy link
Contributor

@retyui retyui commented Jan 12, 2026

Summary:

Issue: #55104

Changelog:

[GENERAL] [CHANGED] - cancelAnimationFrame, clearImmediate, clearTimeout and clearInterval do nothing If there is no callback associated the given handle

Test Plan:

The next code should not throw any errors (runtime and TS)

  const id1 = requestAnimationFrame(()=> {});
  cancelAnimationFrame(id1);
  cancelAnimationFrame(id1); // clear twice the same id
  cancelAnimationFrame(-1);
  cancelAnimationFrame(null);
  cancelAnimationFrame(undefined);

  const id2 = setImmediate(()=> {});
  clearImmediate(id2);
  clearImmediate(id2); // clear twice the same id
  clearImmediate(-1);
  clearImmediate(null);
  clearImmediate(undefined);

  const id3 = setTimeout(()=> {}, 1000);
  clearTimeout(id3);
  clearTimeout(id3); // clear twice the same id
  clearTimeout(-1);
  clearTimeout(null);
  clearTimeout(undefined);

  
  const id4 = setInterval(()=> {}, 1000);
  clearInterval(id4);
  clearInterval(id4); // clear twice the same id
  clearInterval(-1);
  clearInterval(null);
  clearInterval(undefined);

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 12, 2026
@facebook-github-bot facebook-github-bot added p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jan 12, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 13, 2026

@philIip has imported this pull request. If you are a Meta employee, you can view this in D90615301.

@retyui retyui force-pushed the chore/retyui/ts-clearTimer branch from 1f51ff6 to e16f036 Compare January 14, 2026 10:22
@retyui retyui force-pushed the chore/retyui/ts-clearTimer branch from e16f036 to 025a8a6 Compare January 14, 2026 10:26
@retyui retyui requested a review from philIip January 14, 2026 10:26
@meta-codesync meta-codesync bot closed this in 9d3cc38 Jan 16, 2026
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 16, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 16, 2026

@philIip merged this pull request in 9d3cc38.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @retyui in 9d3cc38

When will my fix make it into a release? | How to file a pick request?

@retyui
Copy link
Contributor Author

retyui commented Jan 16, 2026

@cortinico thank for review

@retyui retyui deleted the chore/retyui/ts-clearTimer branch January 16, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants