Describe the bug
Apparently rendering works differently in react and preact in relation to requestAnimationFrame
In Firefox requestAnimationFrame with useLayoutEffect works not the same way as in React 19
Here is a demo of problem:
https://github.com/user-attachments/assets/9a86e4f2-8e7a-441a-b75b-65837397cb74
There is no same problem with React 18/19
To Reproduce
Here is an example repo with simple modal component with implemented open/close transitions:
https://github.com/krutoo/typescript-react/tree/preact-compat-react-19-raf
Opening transition is not working in Firefox with preact/compat - there is no transition visually.
By process of elimination I discovered that the problem was in the requestAnimationFrame call in src/hooks/use-transition-status.ts
Looks like, when Preact is used, requestAnimationFrame callback is called on same render tick that previous render.
Sorry if I use terms that are not applicable to Preact and its rendering model, I just don't know enough about the internals of Preact.
Steps to reproduce the behavior:
- Clone demo branch of repo with fresh Node.js (22+) installed
npm i && npm run dev
- Try open modal in Firefox and see no opening transition
Expected behavior
I'm not sure if this is a problem or a feature of Preact or a feature of my source code.
Describe the bug
Apparently rendering works differently in react and preact in relation to
requestAnimationFrameIn Firefox
requestAnimationFramewithuseLayoutEffectworks not the same way as in React 19Here is a demo of problem:
https://github.com/user-attachments/assets/9a86e4f2-8e7a-441a-b75b-65837397cb74
There is no same problem with React 18/19
To Reproduce
Here is an example repo with simple modal component with implemented open/close transitions:
https://github.com/krutoo/typescript-react/tree/preact-compat-react-19-raf
Opening transition is not working in Firefox with
preact/compat- there is no transition visually.By process of elimination I discovered that the problem was in the
requestAnimationFramecall insrc/hooks/use-transition-status.tsLooks like, when Preact is used,
requestAnimationFramecallback is called on same render tick that previous render.Sorry if I use terms that are not applicable to Preact and its rendering model, I just don't know enough about the internals of Preact.
Steps to reproduce the behavior:
npm i && npm run devExpected behavior
I'm not sure if this is a problem or a feature of Preact or a feature of my source code.