Skip to content

feat(core): support customization of @defer's on idle behavior#67262

Merged
thePunderWoman merged 1 commit intoangular:mainfrom
thePunderWoman:ric-service
Feb 25, 2026
Merged

feat(core): support customization of @defer's on idle behavior#67262
thePunderWoman merged 1 commit intoangular:mainfrom
thePunderWoman:ric-service

Conversation

@thePunderWoman
Copy link
Contributor

This commit makes the behavior of on idle in @defer configurable via DI. It defines an IdleService interface that an application can implement and provide to Angular:

@Injectable({providedIn: 'root'})
export class CustomIdleService implements IdleService {
  requestOnIdle(callback: () => void): number {...}
  cancelOnIdle(id: number): void {...}
}

Then the idle service can be used by providing the IDLE_SERVICE token with the custom implementation.

@thePunderWoman thePunderWoman added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: major This PR is targeted for the next major release labels Feb 24, 2026
@ngbot ngbot bot added this to the Backlog milestone Feb 24, 2026
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Feb 24, 2026
@pullapprove pullapprove bot requested a review from kirjs February 24, 2026 21:15
@thePunderWoman thePunderWoman force-pushed the ric-service branch 2 times, most recently from bb16069 to df5da9e Compare February 24, 2026 22:17
@pullapprove pullapprove bot requested a review from devversion February 24, 2026 23:58
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Feb 24, 2026
This commit makes the behavior of `on idle` in `@defer` configurable via DI.
It defines an `IdleService` interface that an application can implement and
provide to Angular:

```ts
@Injectable({providedIn: 'root'})
export class CustomIdleService implements IdleService {
  requestOnIdle(callback: () => void): number {...}
  cancelOnIdle(id: number): void {...}
}
```

Then the idle service can be used by providing the IDLE_SERVICE token with the custom implementation.
@thePunderWoman thePunderWoman added the action: merge The PR is ready for merge by the caretaker label Feb 25, 2026
@ngbot
Copy link

ngbot bot commented Feb 25, 2026

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@thePunderWoman thePunderWoman merged commit a5981b8 into angular:main Feb 25, 2026
17 of 20 checks passed
@thePunderWoman
Copy link
Contributor Author

This PR was merged into the repository. The changes were merged into the following branches:

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

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants