Skip to content

Commit

Permalink
fix duplicate key bug in breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
beyackle committed Nov 2, 2020
1 parent be78ab3 commit 5f9d19a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 308 deletions.
6 changes: 4 additions & 2 deletions Composer/packages/client/src/pages/design/DesignPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { VisualEditor } from './VisualEditor';
import { PropertyEditor } from './PropertyEditor';

type BreadcrumbItem = {
key: string;
label: string;
link: Partial<TreeLink>;
onClick?: () => void;
Expand Down Expand Up @@ -257,13 +258,15 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st
const breadcrumbArray: Array<BreadcrumbItem> = [];
if (dialogId != null) {
breadcrumbArray.push({
key: 'dialog-' + parentLink?.dialogId,
label: parentLink?.displayName ?? link.displayName,
link: { skillId: skillId ?? projectId, dialogId },
onClick: () => navTo(skillId ?? projectId, dialogId),
});
}
if (trigger != null) {
breadcrumbArray.push({
key: 'trigger-' + parentLink?.trigger,
label: link.displayName,
link: { skillId: skillId ?? projectId, dialogId, trigger },
onClick: () => selectTo(skillId ?? null, dialogId ?? null, `triggers[${trigger}]`),
Expand Down Expand Up @@ -468,14 +471,13 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st

const createBreadcrumbItem: (breadcrumb: BreadcrumbItem) => IBreadcrumbItem = (breadcrumb: BreadcrumbItem) => {
return {
key: breadcrumb.label,
key: breadcrumb.key,
text: breadcrumb.label,
onClick: () => breadcrumb.onClick?.(),
};
};

const items = breadcrumbs.map(createBreadcrumbItem);
console.log(items);

const breadcrumbItems = (
<div style={{ display: 'flex', justifyContent: 'space-between', height: '65px' }}>
Expand Down
Loading

0 comments on commit 5f9d19a

Please sign in to comment.