0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-05-07 18:48:39 +00:00

Fix "onbeforeunload not a function"

should be window.onbeforeunload = xyz. However in this case, it's not needed anyway since we are only adding the event listener once on page load, which already gets cleared when you reload the page.
This commit is contained in:
Trevor Buckner
2026-04-19 15:18:31 -04:00
parent a1624dc649
commit ef207c3936
@@ -273,13 +273,7 @@ const BrewRenderer = (props)=>{
const frameDidMount = ()=>{ //This triggers when iFrame finishes internal "componentDidMount" const frameDidMount = ()=>{ //This triggers when iFrame finishes internal "componentDidMount"
scrollToHash(window.location.hash); scrollToHash(window.location.hash);
window.addEventListener('hashchange', ()=>{ window.addEventListener('hashchange', ()=>scrollToHash(window.location.hash));
scrollToHash(window.location.hash);
});
window.onbeforeunload(()=>{
window.removeEventListener('hashchange');
});
setTimeout(()=>{ //We still see a flicker where the style isn't applied yet, so wait 100ms before showing iFrame setTimeout(()=>{ //We still see a flicker where the style isn't applied yet, so wait 100ms before showing iFrame
renderPages(); //Make sure page is renderable before showing renderPages(); //Make sure page is renderable before showing