fix: stop flames crashing on the way out (teardown removeChild guard) - #33
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix: stop flames crashing on the way out (teardown removeChild guard)#33posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
A pending flame fade could flush its onComplete after the overlay was destroyed, calling app.stage.removeChild on a null stage and throwing "Cannot read properties of null (reading 'removeChild')". - Guard removeElement so it bails when app/app.stage is gone. - Kill in-flight gsap tweens in destroy() before app.destroy(), since gsap is a global singleton driven by our afterUpdate handler and nothing else stops them. - Kill the fade tween in FlameActor.beforeUnload(). - Guard the same unchecked app.stage.removeChild in Hedgehog.beforeUnload. Generated-By: PostHog Code Task-Id: 5b49d7e2-f1aa-49a4-b327-bc5e25485d6c
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
patch notes from a hedgehog who died mid-fade
One user watched a flame quietly try to
removeChilditself into the void — right after the whole overlay had been torn down. Pixi had alreadynulledapp.stage, so the flame's dying wish becameCannot read properties of null (reading 'removeChild'). Three times, in one 170ms burst, because several queued flames all flushed at once. Very dramatic. Very avoidable.what was actually happening
removeElementunconditionally didthis.app.stage.removeChild(element.sprite). Fine while the app is alive. Less fine afterdestroy()runsapp.destroy()and Pixi setsstagetonull.The flames get there via a
gsapfade whoseonCompletecallsremoveElement. Andgsapis a global singleton we drive by hand from the MatterafterUpdatehandler — so nothing was cancelling those tweens on teardown. A pending fade would happily flush against a corpse.what changed
removeElementnow bails ifapp/app.stageis gone instead of dereferencingnull.destroy()kills any in-flight tweens (flame/ghost/web fades, dying hedgehogs) beforeapp.destroy(), so no strayonCompletelands after the lights go out.FlameActor.beforeUnload()kills its own fade tween if it's yanked early.Hedgehog.beforeUnload()got the sameapp.stage?.removeChildguard for its accessory sprites — same latent footgun, one line away.why
Real, reproducible production error (small blast radius — 1 user, 1 session), and mostly worth doing to stop the error-tracking channel from getting these teardown-race pings. It's a robustness fix: teardown should be able to happen mid-animation without a hedgehog throwing on its way out the door.
how it was tested
tsc --noEmit— clean (the dts build agrees).vite build— builds, declarations and all.eslinton the touched files — clean.No new unit test: the existing
test/harness is a leftover stub (imports ahelloWorldthat doesn't exist and already fails), and there's no jsdom/Pixi/Matter/gsap scaffolding to meaningfully exercise a teardown race without building a mocking apparatus from scratch. The change is a set of narrow null-guards + tween cleanup, verified by the type-checker and build.Created with PostHog Code from an inbox report.