primefaces / primefaces/primereact
FileUpload: PT not passed to internal Messages component in advanced mode
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
In advanced mode, the FileUpload component renders an internal component without forwarding the pt prop via ptm('messages'). This makes it impossible to style or hide the Messages via the nested Pass-Through pattern (pt.fileupload.messages).
The global pt.messages workaround works but is unscoped — it affects every instance in the application, not just the one inside FileUpload.
Source reference
In fileupload.js (createAdvanced, ~line 678), the Messages component is rendered without pt:
<Messages ref={messagesRef} __parentMetadata={{ parent: metaData }} />
In contrast, createBasic (~line 742) correctly passes it:
<Messages ref={messagesRef} pt={ptm('message')} __parentMetadata={{ parent: metaData }} />
Reproducer
https://stackblitz.com/edit/vitejs-vite-rkgm9vfm?file=src%2FApp.tsx
System Information
System:
OS: Windows 11 10.0.26200
CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-1370P
Memory: 10.13 GB / 31.66 GB
Binaries:
Node: 24.14.0 - C:\Program Files\nodejs\node.EXE
npm: 11.9.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 149.0.7827.55
Edge: Chromium (140.0.3485.54)
Firefox: 151.0.3 - C:\Program Files\Mozilla Firefox\firefox.exe
Internet Explorer: 11.0.26100.8115
npmPackages:
primereact: ^10.9.7 => 10.9.7
react: ^19.2.3 => 19.2.3
tailwindcss: ^4.1.18 => 4.1.18
Steps to reproduce the behavior
import { PrimeReactProvider } from "primereact/api";
import { FileUpload } from "primereact/fileupload";
const pt = {
fileupload: {
messages: {
root: { className: "hidden" },
},
},
};
export default function App() {
return (
<PrimeReactProvider value={{ unstyled: true, pt }}>
<FileUpload
mode="advanced"
accept="image/*"
maxFileSize={100000}
/>
</PrimeReactProvider>
);
}
- Select a file that exceeds maxFileSize
- Observe that the internal Messages component still renders with default classes (
my-4 rounded-md) - The PT configuration has no effect
Expected behavior
The messages PT section inside fileupload should be applied to the internal component, allowing it to be styled or hidden.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in components/lib/fileupload/FileUpload.js at createAdvanced around line 678, then compare its internal Messages rendering with createBasic around line 742. Use the linked StackBlitz reproducer and verify that the fileupload.messages Pass-Through configuration styles or hides the Messages component in advanced mode without affecting other Messages instances.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100