You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check if updating to the latest Preact version resolves the issue
Describe the bug
AMP is using a function ref to support functional Components exposing a useImperativeHandle API on some (not all expose an API) components. For Components that don't call useImperativeHandle, Preact is calling the function with the VNode, which is inconsistent with React.
Importantly, we don't know if the Component will or won't expose an API, so we must always pass the ref function down. If the Component doesn't expose an API, we expect ref to be unused.
Currently this is the expected behaviour in 11 we would stop applying refs to functional and class components and forward them by default. In X this is a behaviour that is expected as React does it as well
Describe the bug
AMP is using a function ref to support functional Components exposing a
useImperativeHandle
API on some (not all expose an API) components. For Components that don't calluseImperativeHandle
, Preact is calling the function with theVNode
, which is inconsistent with React.Importantly, we don't know if the Component will or won't expose an API, so we must always pass the ref function down. If the Component doesn't expose an API, we expect ref to be unused.
To Reproduce
Function ref: https://codesandbox.io/s/heuristic-easley-mwdzm?file=/index.js
Object ref: https://codesandbox.io/s/objective-kirch-v78v4?file=/index.js
Steps to reproduce the behavior:
useImperativeHandle
inside that ComponentExpected behavior
Refs shouldn't be applied when using functional Component that doesn't call
useImperativeHandle
.The text was updated successfully, but these errors were encountered: