Fix requestAnimationFrame field naming, type, and handle lifecycle#1887
Fix requestAnimationFrame field naming, type, and handle lifecycle#1887willeastcott merged 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR cleans up inspector component code by renaming misnamed requestAnimationFrame handle fields (previously labeled as “timeout”) and correcting an incorrect handle type in the sprite inspector to better reflect requestAnimationFrame/cancelAnimationFrame usage.
Changes:
- Renamed RAF handle fields to use a
_raf*prefix in sprite, script, and model component inspectors. - Corrected the sprite clip-name-change RAF handle type from
ReturnType<typeof setTimeout>tonumber. - Updated corresponding
cancelAnimationFrame/requestAnimationFramecall sites to use the renamed fields.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/editor/inspector/components/sprite.ts | Renames clip-name-change scheduling handle and fixes its type to match RAF usage. |
| src/editor/inspector/components/script.ts | Renames deferred “dirty scripts” RAF handle and updates cancellation/scheduling references. |
| src/editor/inspector/components/model.ts | Renames mappings refresh RAF handle and updates cancellation/scheduling references. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
…raf and fix handle lifecycle Made-with: Cursor
79948a7 to
c2953b6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
requestAnimationFramehandle fields that were misleadingly named with "timeout" to use a_rafprefix, accurately reflecting their use ofrequestAnimationFrame/cancelAnimationFramerather thansetTimeout/clearTimeoutReturnType<typeof setTimeout>tonumberfor_rafClipNameChangeinsprite.tsunlink()to prevent stale state and post-unlink workRenames
sprite.ts_timeoutAfterClipNameChange_rafClipNameChangescript.ts_dirtyScriptsTimeout_rafDirtyScriptsmodel.ts_timeoutRefreshMappings_rafRefreshMappingsLifecycle fixes
sprite.ts:_onAfterClipNameChangenow nulls_rafClipNameChangeon entry (the RAF has already fired);unlink()now cancels+nulls the pending RAFscript.ts:unlink()now nulls_rafDirtyScriptsafter cancelling it (was cancel-only)model.ts: Already had correct lifecycle handling (no changes)