-
Notifications
You must be signed in to change notification settings - Fork 79
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
Perf-Dashboard.Render sync phase sets location.hash, but the actual DOM modifications happen asynchronously in the onhashchange() callback. #488
Conversation
✅ Deploy Preview for webkit-speedometer ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
return; | ||
if(unescapedHash == this._previousHash) | ||
return; | ||
this._previousHash = unescapedHash; | ||
this.route(); | ||
this._hash = null; |
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.
it's not clear to me why this._hash
is set to null here. In _updateURLState
above it looks like we want to keep it synced with location.hash.
Then if we don't reset it, we probably don't need _previousHash and the check above would work, right?
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.
That's a good point, much simpler to do that. Fixed :)
modifications happen asynchronously in the onhashchange() callback. This results in nothing interesting being measured during the sync phase, and the resulting rendering update (during the async phase) not including the change. Change the test to manually and synchronously trigger the onhashchange() callback, and change the page content to detect and omit duplicate events.
f8884de
to
f7cb31b
Compare
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.
Thanks, this looks better to me.
I also looked with a firefox profiler, this clearly captures more work, which sounds good to me.
It would be too to have a sign-off from somebody at Apple who initially brought this in speedometer.
There's just one small correctness issue left to fix, I believe.
Thanks for the fix!
@@ -97,10 +97,11 @@ class PageRouter { | |||
|
|||
_hashDidChange() | |||
{ | |||
if (unescape(location.hash) == this._hash) | |||
let unescapedHash = unescape(location.hash); |
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 think you want decodeURI
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.
Possibly? That's not new to this change though, I just added a local var to cache the result.
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.
mmm right
If the hash doesn't have any encoded char this is OK, but I think this will be buggy as soon as you start having some. Probably we don't have any at the moment.
do we also want to merge the same changes into the 3.1 release branch? |
Yeah, we should probably do that. |
…OM (#488) modifications happen asynchronously in the onhashchange() callback. This results in nothing interesting being measured during the sync phase, and the resulting rendering update (during the async phase) not including the change. Change the test to manually and synchronously trigger the onhashchange() callback, and change the page content to detect and omit duplicate events. Co-authored-by: Matt Woodrow <[email protected]>
Here's a PR to merge the fix into release/3.1: #496 |
…OM (#488) (#496) modifications happen asynchronously in the onhashchange() callback. This results in nothing interesting being measured during the sync phase, and the resulting rendering update (during the async phase) not including the change. Change the test to manually and synchronously trigger the onhashchange() callback, and change the page content to detect and omit duplicate events. Co-authored-by: Matt Woodrow <[email protected]>
This results in nothing interesting being measured during the sync phase, and the resulting rendering update (during the async phase) not including the change.
Change the test to manually and synchronously trigger the onhashchange() callback, and change the page content to detect and omit duplicate events.
Crossbench results before/after the change: