diff --git a/common/changes/@itwin/appui-react/fix-999_2024-09-10-13-57.json b/common/changes/@itwin/appui-react/fix-999_2024-09-10-13-57.json new file mode 100644 index 00000000000..1e724d26052 --- /dev/null +++ b/common/changes/@itwin/appui-react/fix-999_2024-09-10-13-57.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/appui-react", + "comment": "Fix `undefined` property access within `StatusBarComposer` component.", + "type": "none" + } + ], + "packageName": "@itwin/appui-react" +} \ No newline at end of file diff --git a/ui/appui-react/src/appui-react/statusbar/StatusBarComposer.tsx b/ui/appui-react/src/appui-react/statusbar/StatusBarComposer.tsx index afc7157e878..36a650c5f0d 100644 --- a/ui/appui-react/src/appui-react/statusbar/StatusBarComposer.tsx +++ b/ui/appui-react/src/appui-react/statusbar/StatusBarComposer.tsx @@ -345,10 +345,10 @@ export function StatusBarComposer(props: StatusBarComposerProps) { const combinedItems = combineItems(defaultItems, addonItems); return sortItems(combinedItems); }, [defaultItems, addonItems]); - const itemsNotInOverflow = React.useMemo(() => { - return statusBarItems.filter( - (item) => !isItemInOverflow(item.id, overflown) - ); + const notOverflown = React.useMemo(() => { + return statusBarItems + .filter((item) => !isItemInOverflow(item.id, overflown)) + .map((item) => item.id); }, [overflown, statusBarItems]); const calculateOverflow = React.useCallback(() => { @@ -440,10 +440,9 @@ export function StatusBarComposer(props: StatusBarComposerProps) { > ); }, - [handleEntryResize, itemsNotInOverflow, overflown] + [handleEntryResize, notOverflown, overflown] ); const getSectionItems = React.useCallback( diff --git a/ui/appui-react/src/appui-react/statusbar/StatusBarCornerComponentContext.tsx b/ui/appui-react/src/appui-react/statusbar/StatusBarCornerComponentContext.tsx index 39749a72f44..6eb51a93c12 100644 --- a/ui/appui-react/src/appui-react/statusbar/StatusBarCornerComponentContext.tsx +++ b/ui/appui-react/src/appui-react/statusbar/StatusBarCornerComponentContext.tsx @@ -12,3 +12,5 @@ import * as React from "react"; export const StatusBarCornerComponentContext = React.createContext< "right-corner" | "left-corner" | undefined >(undefined); +StatusBarCornerComponentContext.displayName = + "uifw:StatusBarCornerComponentContext";