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

Skip linking if elemented already removed in the meantime #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcin-wosinek
Copy link
Contributor

The edge case I've found was when:

  • view with click-outside was quickly created & remeved - multiple times per second
  • randomly there were listeners added for already removed controllers

My assumption was:

it can be that with quick enough reloads we get:

  • linking delayed as:
// postpone linking to next digest to allow for unique id generation               
$timeout(function() {
  • destroy done in the same digest (if it's even possible), of poped in before the $timeout callback
    if this is true, checking if the scope exists before calling close should fix it.

the assumptions turned out to be right - double checking in the callback with:

      if ($scope.$$destroyed === true) {
        console.log('we are dead!');
        return;
      }

removed the issue form the application code.

In this PR I'm trying to address the rootcause issue

@@ -1,5 +1,5 @@
{
"name": "iamadamjowett/angular-click-outside",
"name": "angular-click-outside",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hack to make the script installable directly from repo. The above one is either typo (it has @ no more), or makes npm double check the source of the code.

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

Successfully merging this pull request may close these issues.

1 participant