Skip to content

Infinite re-rendering if ErrorBoundary is direct child of LocationProvider #277

Open
@ghost

Description

This component tree is crashing my page when I navigate between routes:

<LocationProvider>
    <ErrorBoundary>
        <div>
            <Router>
                <Home path='/' default />
                <About path='/about' />
            </Router>
        </div>
    </ErrorBoundary>
</LocationProvider>

Putting a div as the direct child of LocationProvider fixes it:

<LocationProvider>
    <div>
        <ErrorBoundary>
            <Router>
                <Home path='/' default />
                <About path='/about' />
            </Router>
        </ErrorBoundary>
    </div>
</LocationProvider>

It doesn't have to be a dom element, this also fixes it:

<LocationProvider>
    <SWRConfig value={SWRConfiguration}>
        <ErrorBoundary>
            <Router>
                <Home path='/' default />
                <About path='/about' />
            </Router>
        </ErrorBoundary>
    </SWRConfig>
</LocationProvider>

If there's any additional information needed please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglibpreact-iso, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions