ReactiveX / ReactiveX/rxjs

animationFrameScheduler.schedule work parameter not running

Open
#6,843 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

I'm trying to run a block of code after the end of my method using animationFrameScheduler.schedule, but it is not running.
I've also tried with scheduled(of(0), animationFrameScheduler) but it doesn't work as well.
This was working with versions up to 7.4.

Expected behavior

When I use animationFrameScheduler.schedule, the code in the work method should run at the end of my method.
For the code below, the console output should be

1
2
3
4
5
Reproduction code
toggleExpanded() {
    this.expanded = !this.expanded;
    console.log('1');

    animationFrameScheduler.schedule(function() {
      console.log('3');
    }, 0, 0);
    of(0, animationFrameScheduler).subscribe(() => {
      console.log('4');
    })
    scheduled(of(0), animationFrameScheduler).subscribe(() => {
      console.log('5');
    })

    console.log('2');
  }
Reproduction URL

No response

Version

7.5.4

Environment

OS: macOs Big Sur version 11.2.1

node: v14.16.0
npm: 6.14.11

"dependencies": {
"@angular/animations": "~13.2.0",
"@angular/cdk": "^13.2.3",
"@angular/common": "~13.2.0",
"@angular/compiler": "~13.2.0",
"@angular/core": "~13.2.0",
"@angular/forms": "~13.2.0",
"@angular/platform-browser": "~13.2.0",
"@angular/platform-browser-dynamic": "~13.2.0",
"@angular/router": "~13.2.0",
"rxjs": "7.5.4",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.2.4",
"@angular/cli": "~13.2.4",
"@angular/compiler-cli": "~13.2.0",
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.5.2"
}

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior with RxJS 7.5.4 using animationFrameScheduler.schedule, of, and scheduled, and verify the expected 1–5 output order. Then trace the animationFrameScheduler and scheduled entry points to identify why the work callbacks no longer run; done means the reproduction produces the expected output without regressing scheduler behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.