Skip to content

UntilDestroyed not working #577

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

Closed
3 tasks
sonyz opened this issue Nov 25, 2020 · 4 comments
Closed
3 tasks

UntilDestroyed not working #577

sonyz opened this issue Nov 25, 2020 · 4 comments

Comments

@sonyz
Copy link

sonyz commented Nov 25, 2020

I'm submitting a...

  • [X ] Bug report
  • Feature request
  • Documentation issue or request
  • Question

Current behavior

The UntilDestroyed on Observable is not working. In the ngOnDestroy(), the method is not called correctly.

Expected behavior

The observable must be "destroyed" when ngOnDestroy is automatically called.

Minimal reproduction of the problem with instructions

ngOnInit(): void { let number = Math.floor(Math.random() * 100); // Init scheduled calls to operation statuses interval(5 * 1000) .pipe(startWith(0)) .pipe(untilDestroyed(this)) .subscribe(() => { console.log('test', number); }); }

ngOnDestroy(): void {
console.log('destroyed');
}

The 'destroyed' log is correctly displayed but the observable still exists.

Environment



ngX-Rocket: 9.1.0
Node.js: v12.18.3
Npm: 6.14.6
OS: linux x64 5.4.0-53-generic

Generated project options:
{
  "generator-ngx-rocket": {
    "version": "9.1.0",
    "props": {
      "location": "path",
      "strict": false,
      "skipInstall": false,
      "skipQuickstart": false,
      "initGit": true,
      "usePrefix": true,
      "appName": "app-ui",
      "target": [
        "web"
      ],
      "pwa": false,
      "ui": "bootstrap",
      "auth": true,
      "lazy": false,
      "angulartics": false,
      "languages": [
        "en-US",
        "fr-FR"
      ],
      "tools": [
        "prettier"
      ],
      "utility": [],
      "deploy": "none",
      "projectName": "app-ui",
      "packageManager": "npm",
      "mobile": [],
      "desktop": []
    }
  }
}

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.1.7
Node: 12.18.3
OS: linux x64

Angular: 10.2.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1001.7
@angular-devkit/build-angular   0.1001.7
@angular-devkit/core            10.1.7
@angular-devkit/schematics      10.1.7
@angular/cli                    10.1.7
@schematics/angular             10.1.7
@schematics/update              0.1001.7
rxjs                            6.6.3
typescript                      4.0.3

Others:

@luiza-cicone
Copy link
Collaborator

I had the same problem on an app after migrating to Angular 9 (if I am not mistaken).
@sinedied wdyt of using the ngneat/until-destroy plugin?

@sonyz
Copy link
Author

sonyz commented Dec 1, 2020

I think the workaround is to add the dependency to this plugin and to not use the until-destroy in the package for moment.

@sinedied
Copy link
Member

@luiza-cicone when I wrote the initial version of untilDestroyed, the available version of until-destroy package has some issues, and it fell dumb to add a dependency for a few lines of codes. But it seems that it's now more complex than that with the new Ivy engine, so it's time to migrate and use the better version 👍

@sinedied sinedied added the bug label Jan 12, 2021
ci-rebot pushed a commit that referenced this issue Jan 14, 2021
# [9.2.0](9.1.0...9.2.0) (2021-01-14)

### Bug Fixes

* app not loading with Electron v11 ([1444bf0](1444bf0))
* incorrect hads version ([ba20ff1](ba20ff1))
* rename env script to fix execution in some environments (closes [#575](#575)) ([ec93fdb](ec93fdb))
* update electron templates ([3433465](3433465))
* update generator dependencies ([bda29d9](bda29d9))
* update jest config ([4b4a357](4b4a357))
* update packages and fix peer dependencies ([64098dc](64098dc))
* update RouteReusableStrategy for Angular 11 ([#576](#576)) ([3077f5b](3077f5b))

### Features

* add brazilian portuguese language ([1a6d728](1a6d728))
* enable webpack 5 ([8592a71](8592a71))
* migrate to @ngneat/until-destroy (fix [#577](#577)) ([3a77fcb](3a77fcb))
* update editorconfig (fixes [#580](#580)) ([9f036b3](9f036b3))
@ci-rebot
Copy link
Collaborator

🎉 This issue has been resolved in version 9.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

4 participants