Adding a context with same name not empty after being removed before #25
Open
Description
Hi,
Given the scenario:
// Make a fresh context
genie.addContext('foo');
// Add a wish
genie({ magicWords: 'foo 1', context: 'foo', action: function () { alert('foo 1'); } });
// Remove the context, this deletes the context and wish, right?
genie.removeContext('foo');
// Add Context again with same name
genie.addContext('foo');
// Check contents of "new" context
genie.getWishesInContext('foo');
The "new" context after removing it has the item already in it.
I was expecting the second time creating a context of the same name for it to be empty.
The general scenario is using Angular UI routing's onEnter
and onExit
as I want to build a context for the page and add wishes to that context, based on resolved API data, but, remove that context when the user leaves the page.
I did investigate using the directive but I had similar issues of it not being removed from context when the page is destroyed.
I want to keep my "main" contexts clean of items on the specific page as this is a large system so technically the items cached could have been deleted by other people.
Any ideas?
Metadata
Assignees
Labels
No labels