Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make copy, move and paste work for one bot instead of cross bots #4938

Merged
merged 3 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export const ProjectTree: React.FC<Props> = ({
{
label: formatMessage('Settings'),
onClick: () => {
navigateTo(createBotSettingUrl(bot.projectId, link.skillId));
navigateTo(createBotSettingUrl(link.projectId, link.skillId));
},
},
]
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/client/src/recoilModel/atoms/appState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const onboardingState = atom<{
},
});

export const clipboardActionsState = atom<any[]>({
export const clipboardActionsState = atomFamily<any[], string>({
key: getFullyQualifiedKey('clipboardActions'),
default: [],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import { CallbackInterface, useRecoilCallback } from 'recoil';
import { clipboardActionsState, visualEditorSelectionState } from '../atoms/appState';

export const editorDispatcher = () => {
const setVisualEditorClipboard = useRecoilCallback(({ set }: CallbackInterface) => (clipboardActions: any[]) => {
set(clipboardActionsState, [...clipboardActions]);
});
const setVisualEditorClipboard = useRecoilCallback(
({ set }: CallbackInterface) => (clipboardActions: any[], projectId: string) => {
set(clipboardActionsState(projectId), [...clipboardActions]);
}
);

const setVisualEditorSelection = useRecoilCallback(({ set }: CallbackInterface) => (selection: string[]) => {
set(visualEditorSelectionState, [...selection]);
Expand Down
4 changes: 2 additions & 2 deletions Composer/packages/client/src/shell/useShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function useShell(source: EventSource, projectId: string): Shell {
const isRootBot = rootBotProjectId === projectId;

const userSettings = useRecoilValue(userSettingsState);
const clipboardActions = useRecoilValue(clipboardActionsState);
const clipboardActions = useRecoilValue(clipboardActionsState(projectId));
const featureFlags = useRecoilValue(featureFlagsState);
const {
updateDialog,
Expand Down Expand Up @@ -221,7 +221,7 @@ export function useShell(source: EventSource, projectId: string): Shell {
onFocusEvent: focusEvent,
onFocusSteps: focusSteps,
onSelect: setVisualEditorSelection,
onCopy: setVisualEditorClipboard,
onCopy: (clipboardActions) => setVisualEditorClipboard(clipboardActions, projectId),
createDialog: (actionsSeed) => {
return new Promise((resolve) => {
createDialogBegin(
Expand Down