-
Notifications
You must be signed in to change notification settings - Fork 1
fix: improve memory safety and cleanup in Skeleton component #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
huhuanming
commented
Jan 3, 2026
- Android: Add disposal checks to prevent operations after cleanup
- Android: Implement retry limit to prevent infinite shimmer start loops
- Android: Enhance cleanup in stopShimmer() and dispose() methods
- iOS: Fix potential deadlock in deinit by using async dispatch
- iOS: Improve cleanup of view layers and animations
- Android: Add disposal checks to prevent operations after cleanup - Android: Implement retry limit to prevent infinite shimmer start loops - Android: Enhance cleanup in stopShimmer() and dispose() methods - iOS: Fix potential deadlock in deinit by using async dispatch - iOS: Improve cleanup of view layers and animations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
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 improves memory safety and cleanup mechanisms in the Skeleton component and fixes several issues in the DeviceUtils module. The changes focus on preventing crashes from lifecycle issues, race conditions, and improper thread handling during component disposal.
Key Changes:
- Implemented disposal guards and retry limits to prevent infinite loops and operations after cleanup in Skeleton components
- Fixed potential deadlock in iOS Skeleton deinit by using async dispatch for non-main thread cleanup
- Added input validation and improved cleanup in DeviceUtils color change functionality
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| native-views/react-native-skeleton/ios/Skeleton.swift | Added retry limits, improved deinit cleanup with async dispatch to avoid deadlocks, enhanced layer cleanup |
| native-views/react-native-skeleton/android/src/main/java/com/margelo/nitro/skeleton/Skeleton.kt | Added isDisposed flag with disposal checks, retry limits, improved animator cleanup |
| native-modules/react-native-device-utils/ios/ReactNativeDeviceUtils.swift | Added color value clamping and fixed optional chaining for safer color changes |
| native-modules/react-native-device-utils/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt | Improved thread safety with CopyOnWriteArrayList, better WindowInfoTracker cleanup, added color clamping |
| native-modules/react-native-device-utils/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtilsPackage.kt | Removed unused setReactContext call |
| example/react-native/pages/DeviceUtilsTestPage.tsx | Fixed method name from onSpanningChanged to addSpanningChangedListener |
| .gitignore | Added gradle directory to ignore list |
| .claude/commands/commit.md | Added new documentation file for commit command guidelines |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ils/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt
Show resolved
Hide resolved
...ils/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt
Show resolved
Hide resolved
...ils/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt
Show resolved
Hide resolved
...ils/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt
Show resolved
Hide resolved
...ils/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt
Show resolved
Hide resolved
native-modules/react-native-device-utils/ios/ReactNativeDeviceUtils.swift
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5639ff1250
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@huhuanming 看看 copliot 和 codex 的 review 问题 |
|
修了下,确实有问题 |
|
@claude review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.