primereact icon indicating copy to clipboard operation
primereact copied to clipboard

PrimeReactProvider: Context is not propagated when building PrimeReact in local

Open ivanpajon opened this issue 1 year ago • 0 comments

Describe the bug

It is a bit annoying (or rather unfeasible) to work in unstyled mode locally since the configuration is not propagated through the PrimeReactContext/PrimeReactProvider. For it to work you have to individually pass the unstyled and pt props to each component. I don't know if this may have a solution, since it seems that when compiling the library locally and the components use const context = React.useContext(PrimeReactContext); they are importing the default context of the library, not the one configured in the project that consumes PrimeReact.

Reproducer

https://stackblitz.com/edit/yy65qv?file=src%2Fmain.jsx

PrimeReact version

10.7.0

React version

18.x

Language

ALL

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to reproducer

  2. Inspect datatable bodyrow section

  3. You will see classname CLASSNAME_TEST applied (This is fine) image

  4. Download Stackblitz project to local

  5. Change package.json "primereact": "latest" with your local PrimeReact library path "primereact": "C:\\Users\\YOUR_USER\\Desktop\\primereact\\dist"

  6. Install dependencies again and run project

  7. Now if you inspect datatable bodyrow section you will NOT see classname CLASSNAME_TEST image

This happens with ALL components.

Expected behavior

Configuration applied in PrimeReactProvider is propagated when building PrimeReact in local environment.

ivanpajon avatar Jul 18 '24 16:07 ivanpajon