Skip to content

fix: clean up hedgehog controls on destroy - #45

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

MattPua wants to merge 4 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

@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 11, 2026 2:20pm UTC
hogwars Error Error Sep 11, 2026 2:20pm 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
Generated-By: PostHog Desktop
Task-Id: 8617733e-b663-4043-93e4-9512889a4153
Generated-By: PostHog Desktop
Task-Id: 253ddb55-579e-4794-8532-13cf63f7562c

This branch had an error being deployed

1 failed and 1 active deployments
Preview – hedgehog-mode 8d5af7de Deployed Sep 11, 2026 by vercel[bot]
Preview – hogwars 8d5af7de Deployed Sep 11, 2026 by vercel[bot]
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