Skip to content

Commit

Permalink
Merge branch 'fix/export-modal-issues'
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra committed Feb 1, 2024
2 parents ca90ffe + dd08284 commit 20dce1d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 36 deletions.
69 changes: 37 additions & 32 deletions src/components/other/ExportModal/ExportModal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,39 +298,44 @@ export const Default: ComponentStory<typeof ExportModal> = () => {
];
}}
onGetPredefinedExports={async () => {
console.log("onGetPredefinedExports");
await new Promise((resolve) => setTimeout(resolve, 1000));
return [
{
id: 3,
name: "Exportación de prueba 3",
fields: [
{
key: "active/contador",
},
{
key: "parent1/parent2/test",
},
],
},
{
id: 1,
name: "Exportación de prueba",
fields: [
{
key: "active",
},
],
},
{
id: 2,
name: "Exportación de prueba 2",
fields: [
{
key: "city",
},
],
},
];
console.log("onGetPredefinedExports 2");
return {
predefinedExports: [
{
id: 3,
name: "Exportación de prueba 3",
fields: [
{
key: "active/contador",
},
{
key: "parent1/parent2/test",
},
],
},
{
id: 1,
name: "Exportación de prueba",
fields: [
{
key: "active",
},
],
},
{
id: 2,
name: "Exportación de prueba 2",
fields: [
{
key: "city",
},
],
},
],
keysWithChilds: [],
};
}}
onSavePredefinedExport={async (options: PredefinedExport) => {
await new Promise((resolve) => setTimeout(resolve, 3000));
Expand Down
5 changes: 2 additions & 3 deletions src/components/other/ExportModal/ExportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ export const ExportModalWithContext = (props: ExportModalProps) => {
const onGetPredefinedExportsCallback = useCallback(async () => {
const { predefinedExports, keysWithChilds } =
await onGetPredefinedExports();

if (keysWithChilds.length > 0) {
let updatedTree: ExportField[] = [];
let updatedTree;

for (const entry of keysWithChilds) {
const { key, childs } = entry;
Expand All @@ -143,7 +142,7 @@ export const ExportModalWithContext = (props: ExportModalProps) => {
updatedTree = updateTreeData(updatedTree, key, childs);
}
}
setDataSource(updatedTree);
setDataSource(updatedTree as ExportField[]);
}

return predefinedExports as PredefinedExportMandatoryId[];
Expand Down
2 changes: 1 addition & 1 deletion src/context/LocaleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useLocale = (propLocale?: Locale): LocaleContextType => {
}

if (!context) {
console.error(
console.warn(
"useLocale must be used within a LocaleContextProvider - assuming default locale value",
);
return {
Expand Down

0 comments on commit 20dce1d

Please sign in to comment.