Skip to content

Commit

Permalink
Fix primefaces#6997: MenuBar re-render on props.model changes
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Aug 6, 2024
1 parent 9d86edb commit 556c9a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 4 additions & 3 deletions components/lib/menubar/Menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ export const Menubar = React.memo(
}
};

const createProcessedItems = React.useCallback((items, level = 0, parent = {}, parentKey = '') => {
const createProcessedItems = (items, level = 0, parent = {}, parentKey = '') => {
const _processedItems = [];

items &&
Expand All @@ -511,7 +511,7 @@ export const Menubar = React.memo(
});

return _processedItems;
}, []);
};

useMountEffect(() => {
if (!idState) {
Expand All @@ -536,7 +536,8 @@ export const Menubar = React.memo(
const processed = createProcessedItems(itemsToProcess, 0, null, '');

setProcessedItems(processed);
}, [props.model, createProcessedItems]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.model]);

useUpdateEffect(() => {
const processedItem = activeItemPath.find((p) => p.key === focusedItemInfo.parentKey);
Expand Down
3 changes: 1 addition & 2 deletions components/lib/menubar/MenubarSub.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ export const MenubarSub = React.memo(
const menuitemProps = mergeProps(
{
id,
key: dataId,
'data-id': dataId,
role: 'menuitem',
'aria-label': item.label,
Expand All @@ -259,7 +258,7 @@ export const MenubarSub = React.memo(
);

return (
<li {...menuitemProps}>
<li {...menuitemProps} key={dataId}>
<div {...contentProps}>{content}</div>
{submenu}
</li>
Expand Down

0 comments on commit 556c9a7

Please sign in to comment.