Bug 1960926 - More explicitly wait for sidebar update. r=sidebar-reviewers,kcochrane

This is the front-end side fix. We might want to change the rendering
code too, I'm still investigating if this is web observable.

Differential Revision: https://phabricator.services.mozilla.com/D246131
This commit is contained in:
Emilio Cobos Álvarez
2025-04-22 13:52:06 +00:00
parent df8ae11211
commit 02a342eb75

View File

@@ -1081,13 +1081,11 @@ var SidebarController = {
let fromRects = this._getRects(animatingElements);
// We need to wait for rAF for lit to re-render, and us to get the final
// width. This is a bit unfortunate but alas...
let toRects = await new Promise(resolve => {
requestAnimationFrame(() => {
resolve(this._getRects(animatingElements));
});
});
// We need to wait for lit to re-render, and us to get the final width.
// This is a bit unfortunate but alas...
this.sidebarMain.requestUpdate();
await this.sidebarMain.updateComplete;
let toRects = this._getRects(animatingElements);
const options = {
duration: document.documentElement.hasAttribute("sidebar-expand-on-hover")