Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions Composer/packages/client/src/ShellApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ export function ShellApi() {
}

// persist value change
function handleValueChange(newData, event) {
function handleValueChange({ newData, updatePath }, event) {
let dataPath = '';
if (event.source.name === FORM_EDITOR) {
dataPath = getFocusPath(focusedEvent, focusedSteps[0]);
dataPath = updatePath || getFocusPath(focusedEvent, focusedSteps[0]);
}

const updatedDialog = setDialogData(dialogsMap, dialogId, dataPath, newData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const shellApi = {
return apiClient.apiCall('getState', {});
},

saveData: newData => {
return apiClient.apiCall('saveData', newData);
saveData: (newData, updatePath) => {
return apiClient.apiCall('saveData', { newData, updatePath });
},

navTo: (path, rest) => {
Expand Down Expand Up @@ -103,7 +103,6 @@ function ExtensionContainer() {
apiClient.connect();

apiClient.registerApi('reset', newShellData => {
console.log('FORM: apiReset');
setShellData(newShellData);
});

Expand All @@ -125,8 +124,6 @@ function ExtensionContainer() {

const RealEditor = shellData.data ? getEditor() : null;

console.log('FORM: extension container');

return RealEditor && <RealEditor {...shellData} onChange={shellApi.saveData} shellApi={shellApi} />;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ export interface FormEditorProps {
dialogs: DialogInfo[];
focusPath: string;
focusedEvent: string;
focusedSteps: string[];
isRoot: boolean;
lgFiles: LgFile[];
luFiles: LuFile[];
memory: FormMemory;
onBlur?: () => void;
onChange: (newData: object) => void;
onChange: (newData: object, updatePath?: string) => void;
schemas: EditorSchema;
shellApi: ShellApi;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ const ErrorInfo: React.FC<FallbackProps> = ({ componentStack, error }) => (
);

const ObiFormEditor: React.FC<FormEditorProps> = props => {
const onChange = data => {
props.onChange(data, props.focusedSteps[0] || props.focusedEvent);
};

return (
<ErrorBoundary key={props.focusPath} FallbackComponent={ErrorInfo}>
<FormEditor {...props} />
<FormEditor {...props} onChange={onChange} />
</ErrorBoundary>
);
};
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/extensions/obiformeditor/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface FormData {
export interface ShellApi {
getState: <T = any>() => Promise<T>;
getDialogs: <T = any>() => Promise<T>;
saveData: <T = any>(newData: T) => Promise<void>;
saveData: <T = any>(newData: T, updatePath: string) => Promise<void>;
navTo: (path: string) => Promise<void>;
onFocusSteps: (stepIds: string[]) => Promise<void>;
onFocusEvent: (eventId: string) => Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion Composer/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,7 @@
dependencies:
"@types/react" "*"

"@types/react@*", "@types/react@^16.8.13", "@types/react@^16.8.23":
"@types/react@*", "@types/react@^16.8.0", "@types/react@^16.8.13", "@types/react@^16.8.23":
version "16.9.1"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.1.tgz#862c83b4c9d5cd116e42fd9a4f3694843cd2c051"
integrity sha512-jGM2x8F7m7/r+81N/BOaUKVwbC5Cdw6ExlWEUpr77XPwVeNvAppnPEnMMLMfxRDYL8FPEX8MHjwtD2NQMJ0yyQ==
Expand Down