Skip to content

Commit

Permalink
fix: transfor component names to string
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 16, 2021
1 parent 97515f7 commit 0ab793a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/instrument/src/misc/component-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const componentsFromParams = (
const { component } = element;
const name = componentName(component as string);
if (name) {
// transform to string
element.component = name;
result.push(name);
}
const { of: componentShorthand } = element;
Expand All @@ -32,8 +34,15 @@ export const componentsFromParams = (
result.push(subcomponents);
}
if (typeof subcomponents === 'object') {
Object.keys(subcomponents).forEach(key =>
result.push((subcomponents as any)[key]),
element.subcomponents = Object.keys(subcomponents).reduce(
(acc, key) => ({
...acc,
[key]: componentName(subcomponents[key] as string),
}),
{},
);
Object.keys(element.subcomponents).forEach(key =>
result.push((element.subcomponents as any)[key]),
);
}
return result;
Expand Down

0 comments on commit 0ab793a

Please sign in to comment.