V11: @primereact/headless: InputOtp value is not reflecting immediatly
@dmitrii-nikiforov ci sta già lavorando.
Dal 4/1/2026.
- #8405 di @dmitrii-nikiforov — chiusa senza merge
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Describe the bug
Description
When using the InputOtp component, the value in the onValueChange callback is returned incorrectly.
Actual Behavior
The changes made are not applied immediatly, only at the next change.
Additional information
This is due to the operation of the useState hook.
The set function only updates the state variable for the next render. If you read the state variable after calling the set function, you will still get the old value that was on the screen before your call.
Reproducer
No response
System Information
System:
OS: macOS 26.0.1
CPU: (8) arm64 Apple M3
Memory: 530.36 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - /usr/local/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.9.2 - /usr/local/bin/npm
pnpm: 10.18.3 - /Users/dnikiforov/Library/pnpm/pnpm
bun: 1.3.0 - /Users/dnikiforov/.bun/bin/bun
Browsers:
Firefox: 139.0.1
Safari: 26.0.1
Steps to reproduce the behavior
- Install [email protected]
- Import InputOtp component into the project
- Insert the code from the basic example
- Add a state variable for the input value
- Add the onValueChange prop to component
- In the onValueChange callback, call the state variable set function
- look in the react devtools
Expected behavior
the value changes immediately
- Lingua principale
- CSS
- Stelle
- 8.3k
- Fork
- 1.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di primefaces/primereact
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
primefaces/primereact#8552 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
primefaces/primereact#8550 ·
-
Row checkbox selection tick is invisible in Landing Page Theme sectionForse già presa @Prakash1185 l’ha presa 173 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
primefaces/primereact#8545 ·
-
Dependency conflict between jspdf v4 and jspdf-autotable during npm installForse già presa @Kamran92 l’ha presa 187 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
primefaces/primereact#8537 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
primefaces/primereact#8551 ·