Skip to content

bug: Ionic React Router Memory Leak  #20844

Closed

Description

@wobsoriano

Bug Report

Ionic version:
[x] 4.x

Current behavior:
When navigating through different routes using render method to check if authenticated, I am getting this warning:
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.

Expected behavior:
I have no async requests in my useEffects, so I'm expecting it to not log any warning/errors. I'm using firebase btw.

Code

<IonReactRouter>
    <IonRouterOutlet>
        <Route
            exact
            path="/"
            render={props => {
            return !user ? <Login {...props} /> : <Redirect to="/dashboard" />
            }}
        />
        <Route
            exact
            path="/register"
            render={props => {
            return !user ? (
                <Register {...props} />
            ) : (
                <Redirect to="/dashboard" />
            )
            }}
        />
        <Route
            exact
            path="/dashboard"
            render={props => {
            return user ? <Dashboard {...props} /> : <Redirect to="/" />
            }}
        />
    </IonRouterOutlet>
</IonReactRouter>

Any help would be much appreciated.

Activity

  1. liamdebeasi commented on Mar 23, 2020

    @liamdebeasi
    Contributor

    Thanks for the issue. Can you provide a repo with the code required to reproduce this issue?

  2. added
    needs: reply
    on Mar 23, 2020
  3. ionitron-bot commented on Apr 22, 2020

    @ionitron-bot

    Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

    Thank you for using Ionic!

  4. locked and limited conversation to collaborators on Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: reply

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions