Question regarding MenuBar

UI Components for React
Post Reply
kaho29
Posts: 14
Joined: 18 Aug 2017, 10:57

02 Nov 2017, 15:55

I have a question regarding the Menubar.

I am using it in a project I am working on and noticed the following problem. I use disabled state of the items to mark the currently active MenuItem. It works well except for one thing. When I navigate via a Button that just uses the push method of react-router-redux through this.props.history, everything is rerendered correctly, but the MenuItem created by the NestedMenuItem inside the Menubar is not updated and still has disabled set to true for the last active item.

Code: Select all

<Button id="loginWithLabel"
        label="LOG-IN"
        icon="fa-sign-in"
        onClick={() => { this.navigateTo('/login') }} />

navigateTo = (urlPart) => {
    ...
    //navigate to internal URL
    this.props.history.push(urlPart);
    ...
}                            
Every props and states seem to be ok and every render method is called as expected. Only the MenuItem is not updated and still shows disabled: true in its properties and the render method is not called for this component either.

Is that expected behaviour or am I doing something unexpected or wrong?

The MenuItem causing the problem is created in NestedMenuItem.js from line 105:

Code: Select all

_react2.default.createElement(_MenuItem.MenuItem, { items: this.props.item, onItemClick: function onItemClick(event) {
        return _this2.itemClick(event, _this2.props.item);
    }, root: this.props.root, parentMenu: this.props.parentMenu })

User avatar
optimus.prime
Prime
Posts: 17717
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

03 Nov 2017, 22:39

We'll check and get back to you.

User avatar
aragorn
Posts: 2697
Joined: 29 Jun 2013, 12:38

16 Nov 2017, 13:22

Could you please provide a plunker for us to replicate?
https://plnkr.co/edit/uHHN7wKskRgpHszbPZtj?p=info

kaho29
Posts: 14
Joined: 18 Aug 2017, 10:57

16 Nov 2017, 14:40

I created a simple plunker to showcase the problem. When you klick the button a new Menuitem is added and the disabled state switches from first to second menuitem. As you can see the new item is rendered correctly, but the disabled state stays with the first menuitem.

https://www.dropbox.com/s/xbbd0ju5iquk2 ... j.zip?dl=0

merve7
Posts: 98
Joined: 12 Sep 2017, 10:44

23 Nov 2017, 15:01

Thank you for plunker. We fixed for next version (PrimeReact 1.2.1)

kaho29
Posts: 14
Joined: 18 Aug 2017, 10:57

24 Nov 2017, 17:24

Great, thanks :)

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest