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`.

```tsx
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 ...;
});
```

![Screenshot 2023-03-17 at 18 49 21](https://user-images.githubusercontent.com/5406212/225981809-22f575fa-0ec7-4f94-ae23-bffc8bf7c4dd.png)

In `updateImperativeHandle`, the ref is already an empty object.

![Screenshot 2023-03-17 at 19 13 13](https://user-images.githubusercontent.com/5406212/225985622-b8512a61-3a6b-4958-b63f-277219d4c816.png)

I haven't investigated it further yet, the stacktraces are quite hard to follow.
s
    rootDoesHavePassiveEffects = false;
    rootWithPendingPassiveEffects = root;
    pendingPassiveEffectsLanes = lanes;
  } else {
     T
     p
    releaseRootPooledCache(root, remainingLanes);
    if (__DEV__) {
      nestedPassiveUpdateCount = 0;
      rootWithPassiveNestedUpdates = null;
    }
  }
   Read this again, since an effect might have updated it
  remainingLanes = root.pendingLanes;
   Check if there's remaining work on this root
   TODO: This is part of the `componentDidCatch` implementation. Its purpose
   is to detect whether something might have called setState inside
   `componentDidCatch`. The mechanism is known to be flawed because `setState`
   inside `componentDidCatch` is itself flawed — that's why we recommend
   `getDerivedStateFromError` instead. However, it could be improved by
   checking if remainingLanes includes Sync work, instead of whether there's
   any work remaining at all (which would also include stuff like Suspense
   retries or transitions). It's been like this for a while, though, so fixing
   it probably isn't that urgent.
  if (remainingLanes === NoLanes) {
     If there's no remaining work, we can clear the set of already failed
     error boundaries.
    legacyErrorBoundariesThatAlreadyFailed = null;
  }