Open Patrick2607 opened 8 months ago
This issue is still valid in 1.19.
Example use case is having a little help button in a TdsHeadItem with slot="end", but you only want to show this help if a user is authenticated. If the user loads the website and then authenticates the TdsHeaderItem appears to the right, ignoring slot="end". Reloading the page while authenticated fixes it as then the header is created with the help button already visible.
Hello @luistabotelho & @Patrick2607 , We have looked into this issue and concluded that we cannot solve this at the moment because the proposed solution would introduce a breaking change. We will look at this in the future when we are planning for a release of Tegel with breaking changes. Plan and timing for this is to be defined.
Requirements before reporting
Package versions
@scania/tegel-angular: 1.6.1
Browser
Firefox
Framework
Angular
Version
Angular 16.2.0
Reproduction steps
TdsHeader
and one or moreTdsHeaderItem
elements in your html template*ngIf
directive on theTdsHeaderItem
together withslot="end"
*ngIf
directiveCode example
HTML template:
TS component:
Please note that I’ve constructed a basic example to illustrate this issue. You can replicate the behavior by copying and pasting the provided code into your environment. Once you’ve done that, press
X
in your browser to toggle the value of the*ngIf
directive. Initially, you’ll observe that it renders on the right side. However, upon disabling and re-enabling it, the rendering shifts to the left instead of maintaining its position on the right.I’ve implemented a temporary workaround for this issue by triggering a ‘re-render’ of the entire
TdsHeader
component whenever the view modelvm$
emits. However, this is merely a quick fix as it causes all child components to re-render as well. To illustrate this, please uncomment theconcatMap
function operator in the pipe. Here’s what happens: whenvm$
emits, it first emits a null value. This effectively unrenders the entireTdsHeader
component due to its*ngIf
directive:<tds-header *ngIf="vm$ | async as vm">
. Following this, it emits the actual value, which triggers a re-render of the entireTdsHeader
component. As a result, theTdsHeaderItems
are correctly positioned.Screenshots
Expected behaviour
The
TdsHeaderItem
element should consistently stay anchored to the right side, regardless of whether the element has been re-rendered or not.Console errors
No response
Contact information
patrick.groot.koerkamp@scania.com