mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-12 04:31:11 +00:00
Fix requestAnimationFrame
not always being called when handling embeds
This commit is contained in:
parent
21f6780498
commit
50737ffe97
|
@ -62,6 +62,7 @@ window.addEventListener('message', (e) => {
|
||||||
|
|
||||||
// We use a timeout to allow for the React page to render before calculating the height
|
// We use a timeout to allow for the React page to render before calculating the height
|
||||||
afterInitialRender(() => {
|
afterInitialRender(() => {
|
||||||
|
window.requestAnimationFrame(() => {
|
||||||
window.parent.postMessage(
|
window.parent.postMessage(
|
||||||
{
|
{
|
||||||
type: 'setHeight',
|
type: 'setHeight',
|
||||||
|
@ -72,3 +73,4 @@ window.addEventListener('message', (e) => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -24,9 +24,7 @@ export const useRenderSignal = () => {
|
||||||
renderSignalReceived = true;
|
renderSignalReceived = true;
|
||||||
|
|
||||||
if (typeof onInitialRender !== 'undefined') {
|
if (typeof onInitialRender !== 'undefined') {
|
||||||
window.requestAnimationFrame(() => {
|
|
||||||
onInitialRender();
|
onInitialRender();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user