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; | ||
| this._previousHash = unescapedHash; | ||
| this.route(); | ||
| this._hash = null; |
There was a problem hiding this comment.
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.
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
julienw
left a comment
There was a problem hiding this comment.
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!
| _hashDidChange() | ||
| { | ||
| if (unescape(location.hash) == this._hash) | ||
| let unescapedHash = unescape(location.hash); |
There was a problem hiding this comment.
I think you want decodeURI
There was a problem hiding this comment.
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.
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 <m_woodrow@apple.com>
|
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 <m_woodrow@apple.com>
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: