Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior on Dropdown Link item #3593

Closed
Jean-PhilippeD opened this issue May 1, 2019 · 5 comments
Closed

Strange behavior on Dropdown Link item #3593

Jean-PhilippeD opened this issue May 1, 2019 · 5 comments
Labels

Comments

@Jean-PhilippeD
Copy link

@Jean-PhilippeD Jean-PhilippeD commented May 1, 2019

Bug Report

Using a Dropdown with options as Link, I get the error in a specific case :

Uncaught Invariant Violation: Unable to find node on an unmounted component.

Context :
I use react-router-dom
I've built a Header with Menu component.
The first Menu.Item is a header with a Link to /
The second item is a Component I made which handle a Dropdown Menu with few options, each options is also a Link:

const options = [
        {
            "key": "users",
            "text": "User management",
            "to": "/administration/users/",
            "icon": "users",
            "as": Link
        },
        {
            "key": "mail",
            "text": "Mail management",
            "to": "/administration/mail/",
            "icon": "mail outline",
            "as": Link
        }
    ]

Steps

1.When I'm on route "/" and I refresh the browser and try to click on one item from the dropdown menu, it fails with the error I've pasted upside.
2. If I refresh the browser, being on the route "/administration/users", I get the expected page.
3. Then If I click on the Header Item, I go to / as expected.
4. Then I can now navigate finely to /administration/* without errors.
5. If I refresh again from everywhere, the Dropdown Link Items fails again.

I tried to create a Menu.Item with one of the route in the Dropdown options, and I have no issue with it.

Each time I refresh my browser, the Dropdown Links does not work until I navigate first to a Link outside dropdown menu.

Expected Result

I should not have any errors in routing with Dropdown Item.

Actual Result

As far I do not refresh the page, routing works, but if I refresh the browser, I need to go on / before moving onto routes accessible from dropdown items.

Version

react-router-dom: 5.0.0
react: 16.8.6
semantic-ui: 2.4.2,
semantic-ui-react: 0.86.0

Testcase

If needed, I'll try to make a testcase

@welcome

This comment has been minimized.

Copy link

@welcome welcome bot commented May 1, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@triage-new-issues triage-new-issues bot added the triage label May 1, 2019
@Jean-PhilippeD Jean-PhilippeD changed the title Strane behavior on Dropdown Link item Strange behavior on Dropdown Link item May 1, 2019
@layershifter

This comment has been minimized.

Copy link
Member

@layershifter layershifter commented May 2, 2019

We don't have time to debug your code, please make a minimal repro case.

@Jean-PhilippeD

This comment has been minimized.

Copy link
Author

@Jean-PhilippeD Jean-PhilippeD commented May 2, 2019

I've made a sandbox but I can not reproduce my issue.

But while I was trying things, I found that when I removed the lazy load of route, it seems to fix the bug..
My whole stuff is inside a Suspsence and I load route like this :

const Users = lazy(() => import('./routes/administration/Users'));

And if I just impor it :

import Users from './routes/administration/Users';

I have no more error...

@layershifter

This comment has been minimized.

Copy link
Member

@layershifter layershifter commented May 2, 2019

It looks like the same thing as in: #3562 (comment). As I understand the fix was not released yet: facebook/react#15312

@Jean-PhilippeD

This comment has been minimized.

Copy link
Author

@Jean-PhilippeD Jean-PhilippeD commented May 2, 2019

Ok I thought this fix was released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.