Skip to content

chore: unmount loop#456

Merged
MounirDhahri merged 2 commits intomainfrom
chore/unmount-loops
Mar 2, 2026
Merged

chore: unmount loop#456
MounirDhahri merged 2 commits intomainfrom
chore/unmount-loops

Conversation

@MounirDhahri
Copy link
Member

Description

This PR fixes some memory leaks we had on animated skeleton components. The main issue here, is that when we unmount the skeleton, the loop persists on the native side (because useNativeDriver).

@MounirDhahri MounirDhahri self-assigned this Mar 2, 2026
@artsyit artsyit added the Version: Minor A deploy for new features label Mar 2, 2026
gkartalis
gkartalis previously approved these changes Mar 2, 2026

useEffect(() => {
Animated.loop(
const loop = Animated.loop(
Copy link
Member

Choose a reason for hiding this comment

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

Question: Do we need a different variable here? Or can we use animationRef instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

good idea - i will do that

MrSltun
MrSltun previously approved these changes Mar 2, 2026
Copy link
Member

@MrSltun MrSltun left a comment

Choose a reason for hiding this comment

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

Looks good! 🌟
The code seems a bit confusing to read for me, but that's not a blocker

@MounirDhahri MounirDhahri dismissed stale reviews from MrSltun and gkartalis via f24c2e4 March 2, 2026 11:36
@MounirDhahri
Copy link
Member Author

The code seems a bit confusing to read for me, but that's not a blocker

You can think of the API like the setTimeout API. You need to defined the timeout, assign it to a variable, then on unmout clear it.

@MounirDhahri MounirDhahri merged commit 006b3da into main Mar 2, 2026
8 checks passed
@MounirDhahri MounirDhahri deleted the chore/unmount-loops branch March 2, 2026 11:38
@artsyit
Copy link
Collaborator

artsyit commented Mar 2, 2026

🚀 PR was released in v23.1.0 🚀

@artsyit artsyit added the released This issue/pull request has been released. label Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released This issue/pull request has been released. Version: Minor A deploy for new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants