Abp: Replacement of layout in Angular not working

Created on 13 Jul 2020  路  1Comment  路  Source: abpframework/abp

ABP Framework version: 3.0.3
User Interface: Angular

I've followed the documentation here to replace ApplicationLayoutComponent, but nothing changes when run. The issue happens even in a newly create ABP project. Replacement of other components like logo, etc. works fine, though.

I've did some digging into the source code of DynamicLayoutComponent and found something of interest.

https://github.com/abpframework/abp/blob/a70d21bc5bc73a9a52986b942d2b2d020ec4e346/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts#L39-L65

https://github.com/abpframework/abp/blob/a70d21bc5bc73a9a52986b942d2b2d020ec4e346/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts#L79-L81

What I understand from this code is that layout components are only fetched once when the application starts, any subsequent replacements of layout are not picked up.

bug effort-1 high ui-angular

Most helpful comment

Hi @haivp3010,

First of all, thank you again for this contribution. You are right about the bug. Before we changed how DynamicLayoutComponent was placed in the project, the layout replacement worked as expected. However, as you have proficiently described, this is not the case with the new version.

You have also put valuable time and effort to create a PR and as I expressed in the PR comment, that is most appreciated. Yet, as also described in the PR, we could not accept the proposed changes. Nevertheless, we have implemented required changes with #4741 and with the next release, they will be available.

Briefly, with the latest changes, you will be able to do two things:

  • Replace the layout at application start as described in the documentation and it will work as expected.
  • Replace the layout at any time (e.g. via a button click) by passing a second parameter to the same action and it will reload the layout together with its content. (caveat: component state (not NGXS) will be gone and all initiation logic and HTTP requests will be repeated)

I hope this is a reasonable resolution for this issue.

Have a nice day and thank you again!

>All comments

Hi @haivp3010,

First of all, thank you again for this contribution. You are right about the bug. Before we changed how DynamicLayoutComponent was placed in the project, the layout replacement worked as expected. However, as you have proficiently described, this is not the case with the new version.

You have also put valuable time and effort to create a PR and as I expressed in the PR comment, that is most appreciated. Yet, as also described in the PR, we could not accept the proposed changes. Nevertheless, we have implemented required changes with #4741 and with the next release, they will be available.

Briefly, with the latest changes, you will be able to do two things:

  • Replace the layout at application start as described in the documentation and it will work as expected.
  • Replace the layout at any time (e.g. via a button click) by passing a second parameter to the same action and it will reload the layout together with its content. (caveat: component state (not NGXS) will be gone and all initiation logic and HTTP requests will be repeated)

I hope this is a reasonable resolution for this issue.

Have a nice day and thank you again!

Was this page helpful?
0 / 5 - 0 ratings