-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix): Missing links for nodes in the default values for propDefiniti…
…ons (#911)
- Loading branch information
1 parent
9f1064d
commit cd33102
Showing
4 changed files
with
47 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 12 additions & 1 deletion
13
packages/teleport-uidl-resolver/src/resolvers/abilities/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
import { ComponentUIDL, GeneratorOptions } from '@teleporthq/teleport-types' | ||
import { ComponentUIDL, GeneratorOptions, UIDLElementNode } from '@teleporthq/teleport-types' | ||
import { insertLinks } from './utils' | ||
|
||
export const resolveAbilities = (uidl: ComponentUIDL, options: GeneratorOptions) => { | ||
if (uidl.propDefinitions) { | ||
for (const propKey of Object.keys(uidl.propDefinitions)) { | ||
const prop = uidl.propDefinitions[propKey] | ||
if (prop.type === 'element' && typeof prop.defaultValue === 'object') { | ||
uidl.propDefinitions[propKey].defaultValue = insertLinks( | ||
prop.defaultValue as UIDLElementNode, | ||
options | ||
) | ||
} | ||
} | ||
} | ||
uidl.node = insertLinks(uidl.node, options) | ||
} |