Skip to content

fix: clean up hedgehog controls on destroy - #45

Open
MattPua wants to merge 3 commits into
mainfrom
posthog/fix-game-listener-cleanup
Open

fix: clean up hedgehog controls on destroy#45
MattPua wants to merge 3 commits into
mainfrom
posthog/fix-game-listener-cleanup

Conversation

@MattPua

@MattPua MattPua commented Sep 1, 2026

Copy link
Copy Markdown
Member

Problem

  • After a person closes Hedgehog Mode, normal keyboard input can still reach the old game instance.
  • The old game instance has already destroyed its Pixi renderer.
  • With the Hogzilla skin, a later f keypress can try to add a fireball to that destroyed renderer.
  • The resulting runtime errors retain stale game state and add work after the overlay has closed.
  • This fix removes a confirmed error and memory-retention path. It does not claim to be the only possible memory-growth cause.

Changes

  • Closing the overlay now removes every game element before renderer teardown.
  • Removing the hedgehog now also removes its keyboard handlers and cancels fire and jump timers.
  • Closing the overlay now also removes global keyboard, pointer, resize, and mouse handlers.
  • Element removal now ignores a delayed callback after that element already left the game.
  • The package version moves to 0.0.55 so consumers can take the fix without patching built artifacts.

Testing

  • A control test presses f, destroys controls, advances time, and confirms no more fireball calls occur.
  • A global keyboard test confirms cheat sequences stop after teardown.
  • A lifecycle test confirms elements leave once and ignore a later cleanup callback.
  • The package test suite, lint, and production build pass.

🤖 Agent context

  • Used posthog-desktop to separate the consumer app from the package fix.
  • Used qa-team to review teardown paths and fix the two actionable findings.
  • Used writing-pr-descriptions to revise this PR body.

Created with PostHog Desktop

Generated-By: PostHog Desktop
Task-Id: 8617733e-b663-4043-93e4-9512889a4153
@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hedgehog-mode Ready Ready Preview Sep 1, 2026 5:07pm UTC
hogwars Error Error Sep 1, 2026 5:07pm UTC

Request Review

Generated-By: PostHog Desktop
Task-Id: 8617733e-b663-4043-93e4-9512889a4153
Generated-By: PostHog Desktop
Task-Id: 8617733e-b663-4043-93e4-9512889a4153
@MattPua
MattPua marked this pull request as draft September 1, 2026 17:07
@MattPua
MattPua marked this pull request as ready for review September 1, 2026 17:08
@MattPua
MattPua marked this pull request as draft September 1, 2026 17:10
@MattPua
MattPua requested a review from benjackwhite September 1, 2026 17:10
@MattPua
MattPua marked this pull request as ready for review September 1, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant