p-fileUpload selecting file when fileLimit set to undefined causes js errors #15988
Labels
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
I have a component build on top of fileUpload but with signal inputs. Filelimit property is done like this:
fileLimit: InputSignal<number | undefined> = input<number | undefined>();
and when I don't set it in my component, it passes undefined to primeNg. Then transform does his job and value of fileLimit inside primeNg has null as value:
@Input({ transform: (value: unknown) => numberAttribute(value, null) }) fileLimit: number | undefined;
Then when trying to select file to upload with fileSize limit this functuion is being called:
And when fileLimit is null, this
const hasExistingValidationMessages = this.msgs.length > 0 && this.fileLimit < files.length;
is true and I get error in my js console:
IMHO. What is missing in hasExistingValidationMessages is checking this part:
this.fileLimit
like this:
const hasExistingValidationMessages = this.msgs.length > 0 && this.fileLimit && this.fileLimit < files.length;
or transform should be fixed.
Environment
primeNG 17.8.3
Reproducer
No response
Angular version
17.3.11
PrimeNG version
17.8.3
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
20.12.2
Browser(s)
All
Steps to reproduce the behavior
No response
Expected behavior
No js errors in console
The text was updated successfully, but these errors were encountered: