Skip to content

fix: test to fix closed texture first#49

Merged
kimgh06 merged 1 commit into
mainfrom
fix/textureload
Sep 22, 2025
Merged

fix: test to fix closed texture first#49
kimgh06 merged 1 commit into
mainfrom
fix/textureload

Conversation

@kimgh06

@kimgh06 kimgh06 commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings September 22, 2025 12:12
@kimgh06 kimgh06 merged commit 881c93f into main Sep 22, 2025
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a race condition in the tilemap component by implementing a retry mechanism when the closed layer reference is not immediately available. The fix ensures proper initialization of the sprite pool before attempting to use it.

  • Wraps pool initialization in a retry function that uses requestAnimationFrame to defer execution when the layer reference is null
  • Adds proper cleanup for animation frame requests to prevent memory leaks
  • Updates effect dependencies to include additional variables that affect the pool sizing calculation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

};
ensurePool();
return () => {
if (rafId) cancelAnimationFrame(rafId);

Copilot AI Sep 22, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition if (rafId) is incorrect because rafId could be 0 (a valid requestAnimationFrame ID). This should be if (rafId !== 0) to properly check for a pending animation frame.

Suggested change
if (rafId) cancelAnimationFrame(rafId);
if (rafId !== 0) cancelAnimationFrame(rafId);

Copilot uses AI. Check for mistakes.
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.

2 participants