Skip to content

bug: regression: IonRouterOutlet ref is always undefined #29924

Closed
@aeharding

Description

@aeharding

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

In ionic 8.2.6, I could get the ref (React) like the following:

const ref = useRef();

requestAnimationFrame(() => {
  console.log(ref.current);
});

return <IonRouterOutlet ref={ref} />

Which prints:

image

In Ionic 8.3.2, this prints:

image

Expected Behavior

8.2.6 behavior

Steps to Reproduce

  1. Clone https://github.com/aeharding/bugged-outlet
  2. Checkout branch 8.2.6. Install, ionic serve
  3. Observe expected output in console
  4. Checkout branch 8.3.2. Install, ionic serve
  5. Observe bugged output (all undefined)

Code Reproduction URL

https://github.com/aeharding/bugged-outlet

Ionic Info

Ionic:

   Ionic CLI       : 7.2.0 (/Users/aeharding/.nvm/versions/node/v22.1.0/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 8.3.2

Capacitor:

   Capacitor CLI      : 6.1.2
   @capacitor/android : not installed
   @capacitor/core    : 6.1.2
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : not installed globally

System:

   NodeJS : v22.1.0 (/Users/aeharding/.nvm/versions/node/v22.1.0/bin/node)
   npm    : 10.7.0
   OS     : macOS Unknown

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions