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

added Bootstrapper.destroyHabitats method #23

Merged
merged 2 commits into from
Oct 14, 2017

Conversation

finnfiddle
Copy link
Contributor

I am quite possibly doing something wrong but I found that my components on different pages of my PHP app were not being unmounted when changing pages. Using this.dispose() was removing the Bootstrapper as well so I couldnt manually unload the mounted components so I had to hack it like this:

class MyApp extends Bootstrapper {
  constructor() {
    super();
  }

  cleanUp() {
    // Get open habitats for this container
    const habitats = Habitat.listHabitats(this.__container__.id);
    // Clean up
    for (let i = 0; i < habitats.length; ++i) {
      this.__container__.factory.dispose(habitats[i]);
      Habitat.destroy(habitats[i]);
    }
  }
}

Which seemed to fixed my problem. And I thought this might be useful for others too to be included in the API.

@jennasalau
Copy link
Contributor

Hey Finn,

I think this is a great idea!.. I just feel funny about the name "destroy" as this feels very catastrophic to the users.

What if we change destroyHabitats to unmountHabitats? I think unmount sounds better and also kinda explains what will happen.

Let me know what you think.

@jennasalau jennasalau self-assigned this Oct 13, 2017
@finnfiddle
Copy link
Contributor Author

sounds reasonable - I made the change

@jennasalau jennasalau changed the base branch from master to develop October 14, 2017 00:18
@jennasalau jennasalau merged commit 22c37ec into DeloitteAU:develop Oct 14, 2017
@jennasalau
Copy link
Contributor

This is now available in v0.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants