Open Closed

Angular app crashed when reload page at route file management #9472


User avatar
0
vu.lang created

When reloading the page at the route /file-management, the app in the browser crashes. This issue only occurs upon reloading the page; it functions correctly when navigating to /file-management using the navigation menu. This is the browser console log:

The this.uppy was undefined.

The source code is the class UploadService at angular\projects\file-management\src\lib\services\upload.service.ts

It should be like this to avoid the exception: ngOnDestroy() { this.uppy?.close(); this.subscriptionService.closeAll(); } Please fix this in the next version.


8 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • The error occurs because the code attempts to call this.uppy.close() in ngOnDestroy() without checking if this.uppy is defined. This results in a TypeError when this.uppy is undefined, which can happen on a page reload.
    • To prevent this exception, update the ngOnDestroy() method in your UploadService as follows:
      ngOnDestroy() {
        this.uppy?.close();
        this.subscriptionService.closeAll();
      }
      
    • This change uses optional chaining (?.) to ensure close() is only called if this.uppy is defined, preventing the crash.

    This is a valid bug report and your suggested fix is correct. Please consider submitting this as an issue or pull request to the ABP Framework team if you have not already done so.


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    vu.lang created

    I’m using the Pro version and am unable to create a PR to address this issue. Could someone from the ABP team please look into and resolve this bug?

  • User Avatar
    0
    alper created
    Support Team Director

    Ok I see the issue. @summeyye will check this issue

  • User Avatar
    0
    sumeyye.kurtulus created
    Support Team Angular Expert

    Hello, I’m unable to reproduce the issue on my end. Could you please provide the ABP version you’re using in your project, along with the theme you’ve applied?

  • User Avatar
    0
    vu.lang created

    "@volo/abp.ng.file-management": "~9.0.2" "@volosoft/abp.ng.theme.lepton-x": "~4.0.4"

  • User Avatar
    0
    sumeyye.kurtulus created
    Support Team Angular Expert

    Thank you for providing additional details about the versions. However, I'm still unable to reproduce the issue. Could you also clarify which build system option you're using in your application — browser or application? This distinction can sometimes lead to issues due to differences in builder synchronization and prioritization.

  • User Avatar
    0
    vu.lang created

    Hi, I'm reviewing the UploadService source code, and I noticed that uppy: Uppy; is declared without a default value and isn't initialized in the constructor. This is considered bad practice. Even if the issue isn't immediately reproducible, such practices should be avoided. If you choose not to set a default value, you must ensure that this.uppy is not undefined before using it.

  • User Avatar
    0
    sumeyye.kurtulus created
    Support Team Angular Expert

    Hi again, you are absolutely right — that's a valid point. We will address this issue in the next patch release. Please feel free to reach out if you have any further questions or need additional assistance.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on July 11, 2025, 11:35