Skip to content

Commit

Permalink
Fix error in component template form mappings editor
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaStoeva committed Nov 14, 2024
1 parent de0be81 commit 853f9ff
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { StepMappings } from './step_mappings';

interface Props {
esDocsBase: string;
getTemplateData: (wizardContent: WizardContent) => TemplateDeserialized;
getTemplateData?: (wizardContent: WizardContent) => TemplateDeserialized;
}

export const StepMappingsContainer: React.FunctionComponent<Props> = ({
Expand All @@ -31,9 +31,13 @@ export const StepMappingsContainer: React.FunctionComponent<Props> = ({

const { getData } = Forms.useMultiContentContext<WizardContent>();

const wizardContent = getData();
// Build the current template object, providing the wizard content data
const template = getTemplateData(wizardContent);
let indexMode;
if (getTemplateData) {
const wizardContent = getData();
// Build the current template object, providing the wizard content data
const template = getTemplateData(wizardContent);
indexMode = template?.indexMode;
}

return (
<StepMappings
Expand All @@ -42,7 +46,7 @@ export const StepMappingsContainer: React.FunctionComponent<Props> = ({
indexSettings={getSingleContentData('settings')}
esDocsBase={esDocsBase}
esNodesPlugins={esNodesPlugins ?? []}
indexMode={template?.indexMode}
indexMode={indexMode}
/>
);
};

0 comments on commit 853f9ff

Please sign in to comment.