Base solution for your next web application
Open Closed

Angular API call goes 10 times 1 click v14.2.0 & Login Page Performance Degradation in Production #12516


User avatar
0
stanley5389 created

I already opened this issue. When can resolve? https://support.aspnetzero.com/QA/Questions/12507/Migration-Delete-action-issue

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

23 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    This situation has been answered in this support ticket comment.

    Thank you.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    Hi, Having problem Postman. If pass Abp.TenantId in header Not receives here if (!AbpSession.TenantId.HasValue) Error here

    [HttpPost] public async Task<AuthenticateResultModel> Authenticate([FromBody] AuthenticateModel model) { if (UseCaptchaOnLogin()) { await ValidateReCaptcha(model.CaptchaResponse); }

      var loginResult = await GetLoginResultAsync(
          model.UserNameOrEmailAddress,
          model.Password,
          GetTenancyNameOrNull()
      );
    

    ....}

    Null here private string GetTenancyNameOrNull() { if (!AbpSession.TenantId.HasValue) { return null; }

     return _tenantCache.GetOrNull(AbpSession.TenantId.Value)?.TenancyName;
    

    }

    https://docs.aspnetzero.com/aspnet-core-mvc/latest/Features-Angular-Token-Based-Authentication

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @stanley5389

    May I know your ABP package version? The TenantId header format has changed in recent ABP packages. Could you try sending it as shown in the screenshot below?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    I'm using latest version 14.3.0 .Net 9

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @stanley5389

    Have you tried sending the tenant id as Abp-TenantId in Postman Header? The document seems to be outdated. We will update it.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    I'm sending both ways Won't work Help me out where to pass

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @stanley5389

    You shouldn't pass the tenant ID in the header with Abp.TenantId. The new format is configured as Abp-TenantId. If you send a post request in the header with Abp.TenantId, the system will log in as the Host user because AbpSession.TenantId will be null. You can verify this by using the UserId returned in the body. Could you please provide more details about the exact part you're experiencing the issue with?

    If you do not send the Abp-TenantId header information, the system will log in as the Host user.

    Old Format: Abp.TenantId

    New Format: Abp-TenantId

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    Hi Working Now. Thanks.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @stanley5389

    Happy to hear that. Let us know if you need anything else.

    Thank you

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    Hi, Problem was If I tab 1 time angular project it goes more than 10 API calls. Help me out.

    The version I'm using API: v14.2.0 | Client: v14.2.0 [20251002]

    .Net 9 angular not single solution project

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @stanley5389

    Could you please share the related Angular component code where the API call is triggered? That will help us reproduce and guide you with a fix.

    • The ngOnChanges lifecycle hook runs every time an @Input() property on your component changes. If an input is changing frequently, it can trigger a flood of API calls.
    • If a component is frequently destroyed and re created (e.g., due to @if or routing), a new subscription is made every time in ngOnInit. If you don't unsubscribe, you create memory leaks and duplicate
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    I have shared entire developer folder is that enough? https://www.filemail.com/d/icyapetcwswuwlt

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    We are currently experiencing two key issues:

    Excessive API Calls on Menu Tab When the menu is accessed (via tab), it triggers more than 10 API calls, which seems excessive and could impact performance.

    Login Page Performance Degradation in Production A few days after deployment to production, the login page begins to load very slowly. Interestingly, opening the browser developer tools (F12) seems to trigger the page to load properly. However, after logging in, the system hangs on the loading spinner and does not navigate to the dashboard. The issue is temporarily resolved by logging into the VM and restarting the application.

    Please advise on how we can investigate and resolve these problems.

    I have shared the URL & credentials to the support email. Please find there. Thanks.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @stanley5389

    Yes, the file link and email you provided are sufficient. I have started reviewing the issue and will get back to you as soon as possible.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    [oguzhanagir] said: Hi @stanley5389

    Yes, the file link and email you provided are sufficient. I have started reviewing the issue and will get back to you as soon as possible.

    If you want full source Let me know. I'll add you in to my Git Repo.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @stanley5389

    Yes, if you can share the full source code with us, it will be faster for us to reach the problem. Thank you

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    [oguzhanagir] said: Hi @stanley5389

    Yes, if you can share the full source code with us, it will be faster for us to reach the problem. Thank you

    @oguzhanagir As per your request I have shared the code to the support. Please have a look get back to me ASAP. Thanks

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    [oguzhanagir] said: Hi @stanley5389

    Yes, if you can share the full source code with us, it will be faster for us to reach the problem. Thank you

    Hello, Can I get Update today?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    [oguzhanagir] said: Hi @stanley5389

    Yes, if you can share the full source code with us, it will be faster for us to reach the problem. Thank you

    Hello there? @oguzhanagir

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @stanley5389

    Sorry for the late reply. I needed to investigate further to find the issue, but fortunately, we were able to identify it. This issue is occurring due to the abp-datetime-picker component you're using in your HTML component. Applying the changes below will resolve the multiple requests issue.

    abp-datetime-picker.component.ts

    export class AbpDateTimePickerComponent extends AbstractNgModelComponent {
        @Output() onHidden = new EventEmitter<void>();
    

    abp-datetime-picker.component.html

    <input
        type="text"
        class="form-control"
        #datePicker
        bsDatepicker
        [bsValue]="lastDate"
        (bsValueChange)="setDate($event)"
        (onHidden)="onHidden.emit()" // Insert attribute
        [bsConfig]="bsConfig()" />
    

    After making these changes, you need to make changes everywhere you use the abp-datetime-picker component, as in the example below.

    Example

    Old Code Snippet

    <abp-datetime-picker
        [(ngModel)]="minCreatedAtFilter"
        (ngModelChange)="getTaxiDrivers()"
        id="MinCreatedAtFilter"
        name="MinCreatedAtFilter"
        [bsConfig]="{ adaptivePosition: true }">
    </abp-datetime-picker>
    

    New Code Snippet

    <abp-datetime-picker
        [(ngModel)]="minCreatedAtFilter"
        (onHidden)="getTaxiDrivers()" //The changing part
        id="MinCreatedAtFilter"
        name="MinCreatedAtFilter"
        [bsConfig]="{ adaptivePosition: true }">
    </abp-datetime-picker>
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    I'm really appreciated and Thanks a lot @oguzhanagir. The GetFileAllowedTypes goes 3 call? Please FInd the image.

    How about the other problem? Login Page Performance Degradation in Production A few days after deployment to production, the login page begins to load very slowly. Interestingly, opening the browser developer tools (F12) seems to trigger the page to load properly. However, after logging in, the system hangs on the loading spinner and does not navigate to the dashboard. The issue is temporarily resolved by logging into the VM and restarting the application.

    I followed this to Upgrade to latest version not working https://docs.aspnetzero.com/common/latest/Version-Updating

    If possible can you share me the git commands

    In this Version Light mode The table & dropdown Black color How to turn it to White?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    stanley5389 created

    [stanley5389] said: @oguzhanagir.

    Hello, @oguzhanagir Have you looked?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @stanley5389

    • GetFileAllowedTypes checks three separate requests because there are three separate file upload fields on your restaurant shop page. Therefore, it appears as three requests in the Network tab.

    • Is this what you meant? You need to apply the Primeng darkmode selector setting. Otherwise, your application will be incompatible with the Primeng component theme styles. To resolve this issue, you need to perform the setting found in this link.

    • Do you have any logs when this long wait occurs? If so, which process is causing the long wait? And are there any console errors? I need this information from you because I can't reproduce this issue. I checked your live project and it seems fine. Could you please let us know when the issue occurs?

    Thank you.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)