-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUGFIX beta] Ensure App.visit
resolves when rendering completed.
#16087
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
packages/ember-glimmer/tests/integration/render-settled-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { | ||
RenderingTestCase, | ||
moduleFor, | ||
strip | ||
} from 'internal-test-helpers'; | ||
import { renderSettled } from 'ember-glimmer'; | ||
import { all } from 'rsvp'; | ||
import { run } from 'ember-metal'; | ||
|
||
moduleFor('renderSettled', class extends RenderingTestCase { | ||
['@test resolves when no rendering is happening'](assert) { | ||
return renderSettled().then(() => { | ||
assert.ok(true, 'resolved even without rendering'); | ||
}); | ||
} | ||
|
||
['@test resolves renderers exist but no runloops are triggered'](assert) { | ||
this.render(strip`{{foo}}`, { foo: 'bar' }); | ||
|
||
return renderSettled().then(() => { | ||
assert.ok(true, 'resolved even without runloops'); | ||
}); | ||
} | ||
|
||
['@test does not create extraneous promises'](assert) { | ||
let first = renderSettled(); | ||
let second = renderSettled(); | ||
|
||
assert.strictEqual(first, second); | ||
|
||
return all([first, second]); | ||
} | ||
|
||
['@test resolves when rendering has completed (after property update)']() { | ||
this.render(strip`{{foo}}`, { foo: 'bar' }); | ||
|
||
this.assertText('bar'); | ||
this.component.set('foo', 'baz'); | ||
this.assertText('bar'); | ||
|
||
return renderSettled().then(() => { | ||
this.assertText('baz'); | ||
}); | ||
} | ||
|
||
['@test resolves in run loop when renderer has settled'](assert) { | ||
assert.expect(3); | ||
|
||
this.render(strip`{{foo}}`, { foo: 'bar' }); | ||
|
||
this.assertText('bar'); | ||
let promise; | ||
|
||
return run(() => { | ||
run.schedule('actions', null, () => { | ||
this.component.set('foo', 'set in actions'); | ||
|
||
promise = renderSettled().then(() => { | ||
this.assertText('set in afterRender'); | ||
}); | ||
|
||
run.schedule('afterRender', null, () => { | ||
this.component.set('foo', 'set in afterRender'); | ||
}); | ||
}); | ||
|
||
// still not updated here | ||
this.assertText('bar'); | ||
|
||
return promise; | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rwjblue Sorry to bring up something old, but seeing some memory leaks in fastboot related to retaining the Container. Is it necessary to return
this
in the callback? I think it is, but wondering if it is possible this never resolves but the app still is rendered.What I'm worries about is never reaching a
settled
state or resolving, thus every request that comes in builds a new instance (w/ shoebox data) and the eventually swamps the server's heap.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On 3.5 right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more info. I'm wondering if we need to "settle" the deferred promise when
shouldRender
is false....So not this block but the above block.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really follow. Can you file an issue with a reproduction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rwjblue - We found it. Well @Serabe found it so I'll let him explain beyond this short answer! In an adapter, he found that
headers
as a computed was potentially leaking the container thus not allowing V8 to not gc anything. The problem wasn't necessarily ajax/najax/node-fetch but the way we configured our adapter.to a getter fixed it.
We are on 3.5 and still investigating