primefaces / primeng

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

Component: Dialog - problem with SSR during set the modal mode. #15352

Closed kusmierczykw closed 2 weeks ago

kusmierczykw commented 2 weeks ago

Describe the bug

During build application with SSR mode there is a problem with access to the document, because the document object is not avaible on the server side.

ReferenceError: document is not defined at _Dialog.disableModality (/app/node_modules/primeng/fesm2022/primeng-dialog.mjs:854:30) at _Dialog.onContainerDestroy (/app/node_modules/primeng/fesm2022/primeng-dialog.mjs:1172:12) at document (/app/node_modules/primeng/fesm2022/primeng-dialog.mjs:1195:12) at executeOnDestroys (/app/node_modules/@angular/core/fesm2022/core.mjs:10462:32) at cleanUpView (/app/node_modules/@angular/core/fesm2022/core.mjs:10365:9) at destroyViewTree (/app/node_modules/@angular/core/fesm2022/core.mjs:10193:21) at destroyLView (/app/node_modules/@angular/core/fesm2022/core.mjs:10338:9) at ViewRef$1.destroy (/app/node_modules/@angular/core/fesm2022/core.mjs:13127:9) at eval (/app/node_modules/@angular/core/fesm2022/core.mjs:31588:56) at Array.forEach ()

Angular version

17.3.0

PrimeNG version

17.12.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

v20.11.1

Steps to reproduce the behavior

Set the [modal] property during using Angular with SSR support.

<p-dialog
  [modal]="true"
  [visible]="true">

// Content of the dialog
</p-dialog>

Expected behavior

No response