Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileUpload: Can't change badges to success since update to version 10.8.4 #7449

Closed
ismailmemis opened this issue Nov 27, 2024 · 1 comment
Closed
Labels
Status: Needs Reproducer Issue needs a runnable reproducer

Comments

@ismailmemis
Copy link

ismailmemis commented Nov 27, 2024

Describe the bug

In primereact version 10.7.0, i was able to handle uploaded files as follows:

in primreact version 10.7.0 I was able to manage my uploaded files as follows:

`const handleUpload = (event: FileUploadHandlerEvent) => {

const uploadedFiles = event.files.
let pngFiles: File[] = [];
let otherFiles: File[] = [];

uploadedFiles.forEach((file)=> {
if(file.name.endsWith("png")) {
pngFiles.push(file);
}else{
otherFiles.push(file);
}
}
fileUploadRef.current!.setFiles(otherFiles);
fileUploadRef.current!.setUploadedFiles(pngFiles);
}`

So if my File is a png, it gets the badge Success, otherwise it stays on pending.
After the update to primereact version 10.8.4, i get the following error when setting fileUploadRef.current!.setFiles(otherFiles)

Argument of type 'File[]' is not assignable to parameter of type 'FileUploadFile[]'.
Type 'File' is not assignable to type 'FileUploadFile'.
Property 'objectURL' is missing in type 'File' but required in type '{ objectURL: string; }'.ts(2345)
fileupload.d.ts(142, 32): 'objectURL' is declared here.

After changing everything to FileUploadFile, i get no warning in my code, but when successfully uploaded a file, i then see N.a.N instead of file metadata in my view, whereas the badge still stays on pending.

Reproducer

No response

System Information

System:
    OS: Windows 11 10.0.22621
    CPU: (12) x64 13th Gen Intel(R) Core(TM) i7-1355U
    Memory: 16.00 GB / 31.69 GB
  Binaries:
    Node: 21.6.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.5.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (129.0.2792.65)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    primereact: 10.8.4 => 10.8.4
    react: ^18.2.0 => 18.3.1

Steps to reproduce the behavior

No response

Expected behavior

No response

@ismailmemis ismailmemis added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 27, 2024
@melloware melloware added Status: Needs Reproducer Issue needs a runnable reproducer and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 2, 2025
Copy link

github-actions bot commented Jan 2, 2025

Please fork the Stackblitz project and create a case demonstrating your bug report. This issue will be closed if no activities in 20 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Reproducer Issue needs a runnable reproducer
Projects
None yet
Development

No branches or pull requests

2 participants