Skip to content

Comments

WIP feat(core): Support optional timeout for idle deferred triggers#67190

Draft
SkyZeroZx wants to merge 1 commit intoangular:mainfrom
SkyZeroZx:feature/add-on-idle-options
Draft

WIP feat(core): Support optional timeout for idle deferred triggers#67190
SkyZeroZx wants to merge 1 commit intoangular:mainfrom
SkyZeroZx:feature/add-on-idle-options

Conversation

@SkyZeroZx
Copy link
Contributor

@SkyZeroZx SkyZeroZx commented Feb 21, 2026

Important

It's still a work in progress, however any comments/suggestions are welcome

This change allows supply a timeout value in the on idle trigger of an Angular @defer block, which translates into passing the timeout option to requestIdleCallback.

That way, if the browser doesn’t schedule the callback soon enough, the work will run no later than the specified timeout in options

Usage

@defer (on idle(500)) {
 <heavy-component />
}

@defer (prefetch on idle(500)) {
 <heavy-component />
}

@defer (hydrate on idle(500)) {
 <heavy-component />
}

Other information

Another alternative is to allow an object as a configuration like the following (Similar like @defer (on viewport(<options>)) with intersection observer options )
I'm not sure considering that currently there is only timeout as an option.

@defer (on idle({ timeout : 500 })) {
  <heavy-component />
}

Allows specifying a timeout parameter for idle-based deferred triggers, enabling more granular control over when deferred actions are executed.

Closes angular#67187
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: core Issues related to the framework runtime labels Feb 21, 2026
@ngbot ngbot bot added this to the Backlog milestone Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant