Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

onDestroy not called when navigating #314

Description

@daveychu

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

Activity

  1. changed the title [-]onDestroy not called when navigating back via actionBar[/-] [+]onDestroy not called when navigating[/+] on Sep 16, 2022
  2. CatchABus commented on Oct 12, 2023

    @CatchABus
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions