React version: 18.3.0-next-3ba7add60-20221201
Hard to reproduce.
In Next.js, in rare cases, and only after a fast refresh, the ref object when using forwardRef is simply {}.
This leads to the TypeError: can't define property "current": Object is not extensible error when used with useImperativeHandle.
function Parent() {
const carouselRef = useRef<any>();
return <Suspense><Carousel ref={carouselRef} /></Suspense>
}
const Carousel = forwardRef((props, ref) => {
if (!('current' in ref)) { debugger; }
const thing = use(aPromise);
return ...;
});

In updateImperativeHandle, the ref is already an empty object.

I haven't investigated it further yet, the stacktraces are quite hard to follow.