Skip to content

with-sentry error infinite loop #11001

@pooriamo

Description

@pooriamo

I used the example with-sentry But it put the page in infinite loop when an error occured.

The problem is in getDerivedStateFromError method.

static getDerivedStateFromError() {
    // React Error Boundary here allows us to set state flagging the error (and
    // later render a fallback UI).
    return { hasError: true }
}

After each error, getDerivedStateFromError is setting hasError to true and makes the component re-render!

Is this even a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueEasy to fix issues, good for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions