mirror of https://github.com/tootsuite/mastodon
Fix `requestAnimationFrame` not always being called when handling embeds
parent
21f6780498
commit
50737ffe97
|
@ -62,13 +62,15 @@ window.addEventListener('message', (e) => {
|
|||
|
||||
// We use a timeout to allow for the React page to render before calculating the height
|
||||
afterInitialRender(() => {
|
||||
window.parent.postMessage(
|
||||
{
|
||||
type: 'setHeight',
|
||||
id: data.id,
|
||||
height: document.getElementsByTagName('html')[0]?.scrollHeight,
|
||||
},
|
||||
'*',
|
||||
);
|
||||
window.requestAnimationFrame(() => {
|
||||
window.parent.postMessage(
|
||||
{
|
||||
type: 'setHeight',
|
||||
id: data.id,
|
||||
height: document.getElementsByTagName('html')[0]?.scrollHeight,
|
||||
},
|
||||
'*',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,9 +24,7 @@ export const useRenderSignal = () => {
|
|||
renderSignalReceived = true;
|
||||
|
||||
if (typeof onInitialRender !== 'undefined') {
|
||||
window.requestAnimationFrame(() => {
|
||||
onInitialRender();
|
||||
});
|
||||
onInitialRender();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue