Skip to content

Commit 21b3733

Browse files
authored
Merge pull request #20053 from cafreeman/cfreeman/expose-render-settled
2 parents a5e8e6f + 8343fea commit 21b3733

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

packages/@ember/renderer/index.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
@module @ember/renderer
3+
@public
4+
*/
5+
6+
/**
7+
* @class Renderer
8+
* @public
9+
*/
10+
11+
/**
12+
Returns a promise which will resolve when rendering has completed. In
13+
this context, rendering is completed when all auto-tracked state that is
14+
consumed in the template (including any tracked state in models, services,
15+
etc. that are then used in a template) has been updated in the DOM.
16+
17+
For example, in a test you might want to update some tracked state and
18+
then run some assertions after rendering has completed. You _could_ use
19+
`await settled()` in that location, but in some contexts you don't want to
20+
wait for full settledness (which includes test waiters, pending AJAX/fetch,
21+
run loops, etc) but instead only want to know when that updated value has
22+
been rendered in the DOM. **THAT** is what `await rerender()` is _perfect_
23+
for.
24+
@method renderSettled
25+
@returns {Promise<void>} a promise which fulfills when rendering has completed
26+
@public
27+
*/
28+
29+
export { renderSettled } from '@ember/-internals/glimmer';

tests/docs/expected.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ module.exports = {
420420
'removeObjects',
421421
'removeObserver',
422422
'removeTestHelpers',
423+
'renderSettled',
423424
'reopen',
424425
'reopenClass',
425426
'replace',

0 commit comments

Comments
 (0)