Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit ead752b

Browse files
committed
always go to dialog on click (not to a trigger in it)
1 parent 3219bad commit ead752b

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

Composer/packages/client/src/pages/design/DesignPage.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,10 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st
257257
createTrigger(dialogId, formData);
258258
};
259259

260-
function handleSelect(link: TreeLink, selectPath = '') {
260+
function handleSelect(link: TreeLink) {
261261
updateZoomRate({ currentRate: 1 });
262-
if (link.trigger != null || selectPath) {
263-
const path = link.trigger == null ? selectPath : `triggers[${link.trigger}]`;
264-
selectTo(link.skillId ?? link.projectId, link.dialogId ?? null, path);
262+
if (link.trigger != null) {
263+
selectTo(link.skillId ?? null, link.dialogId ?? null, `triggers[${link.trigger}]`);
265264
} else if (link.dialogId != null) {
266265
navTo(link.skillId ?? link.projectId, link.dialogId, []);
267266
} else {

Composer/packages/client/src/recoilModel/dispatchers/navigation.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,34 +50,20 @@ export const navigationDispatcher = () => {
5050

5151
const navTo = useRecoilCallback(
5252
({ snapshot, set }: CallbackInterface) => async (
53-
projectId: string,
53+
skillId: string | null,
5454
dialogId: string | null,
5555
breadcrumb: BreadcrumbItem[] = []
5656
) => {
5757
const rootBotProjectId = await snapshot.getPromise(rootBotProjectIdSelector);
5858
if (rootBotProjectId == null) return;
5959

60-
const dialogs = await snapshot.getPromise(dialogsSelectorFamily(projectId));
60+
const projectId = skillId ?? rootBotProjectId;
61+
6162
const designPageLocation = await snapshot.getPromise(designPageLocationState(projectId));
6263
const updatedBreadcrumb = cloneDeep(breadcrumb);
6364
set(currentProjectIdState, projectId);
6465

65-
let path;
66-
if (dialogId !== designPageLocation.dialogId) {
67-
if (dialogId == null) {
68-
} else {
69-
const currentDialog = dialogs.find(({ id }) => id === dialogId);
70-
const beginDialogIndex = currentDialog?.triggers.findIndex(({ type }) => type === SDKKinds.OnBeginDialog);
71-
72-
if (typeof beginDialogIndex !== 'undefined' && beginDialogIndex >= 0) {
73-
path = createSelectedPath(beginDialogIndex);
74-
path = encodeArrayPathToDesignerPath(currentDialog?.content, path);
75-
updatedBreadcrumb.push({ dialogId, selected: '', focused: '' });
76-
}
77-
}
78-
}
79-
80-
const currentUri = convertPathToUrl(rootBotProjectId, projectId, dialogId, path);
66+
const currentUri = convertPathToUrl(rootBotProjectId, projectId, dialogId);
8167
if (checkUrl(currentUri, rootBotProjectId, projectId, designPageLocation)) return;
8268

8369
navigateTo(currentUri, { state: { breadcrumb: updatedBreadcrumb } });

0 commit comments

Comments
 (0)