primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.56k stars 4.61k forks source link

p-sidebar: can't open onInit #14605

Closed che-ressoucenmangel closed 5 months ago

che-ressoucenmangel commented 9 months ago

Describe the bug

When i use the p-sidebar-component und want to display it onInit, the sidebar seems to be called multiple times.

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [CommonModule, RouterOutlet, CardModule, ButtonModule, SidebarModule],
  templateUrl: './app.component.html',
  styleUrl: './app.component.scss'
})

export class AppComponent {
  sidebarVisible = true; // same issue when i call it in the constructor or onInit or any other Livecycle-Hook
}

app.component.html:

<p-sidebar [(visible)]="sidebarVisible">
  <h3>Sidebar</h3>
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  </p>
</p-sidebar>
<p-button (click)="sidebarVisible = true" icon="pi pi-arrow-right"></p-button>

I would like to load components inside the Sidebar onInit for a router-outlet. So for specific urls you can directly access the sidebar-content. But with this bug this is not possible. You can close the Sidebar itself (this is only exist once) - but the mask is generated multiple times and you can just get rid of one, closing the sidebar.

I don't what to disable the mask. I know this would help, but i hope you can fix this or have another workaround :)

Thx for any help!

Environment

mac-os 13.6 (22G120)

Reproducer

No response

Angular version

17.0.5

PrimeNG version

17.3.3

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.11.0

Browser(s)

Google Chrome: Version 120.0.6099.216

Steps to reproduce the behavior

Just init the code below and you should see the Problem directly

Expected behavior

The sidebar and mask should only show once.

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale. If this issue is still affecting you with the latest version, please leave any comment, and we will keep it open. We are sorry that we have not been able to prioritize it yet. If you have any new additional information, please include it with your comment!

github-actions[bot] commented 5 months ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you for your understanding!