Skip to content
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

onDestroy not called when navigating #314

Open
daveychu opened this issue Sep 16, 2022 · 1 comment
Open

onDestroy not called when navigating #314

daveychu opened this issue Sep 16, 2022 · 1 comment

Comments

@daveychu
Copy link

daveychu commented Sep 16, 2022

With Svelte we can do some cleanup when a component is destroyed by either returning a function in onMount or using onDestroy. These are both ignored when navigating back via actionBar or using navigate.

Reproduction: https://github.com/daveychu/svelte-native-on-destroy-bug

  • ns run ios
  • Tap "Tap me" to go to "Details"
  • Tap the back button in the action bar or "Tap me" to go back to "Home"
  • Expected: Both intervals cleared
  • Actual: None are cleared
@daveychu daveychu changed the title onDestroy not called when navigating back via actionBar onDestroy not called when navigating Sep 16, 2022
@CatchABus
Copy link
Contributor

Page components are usually cached for backwards navigation, and that might be why you face this problem.
Upon navigating back using back button or goBack method, component will trigger onDestroy callback.

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

No branches or pull requests

2 participants