Skip to content

Commit

Permalink
feat(attributes): dynamic default
Browse files Browse the repository at this point in the history
  • Loading branch information
mylesj committed Nov 1, 2022
1 parent 2b69f34 commit bd93a65
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core/src/helpers/getAttributesFromExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ export function getAttributesFromExtensions(extensions: Extensions): ExtensionAt
...attribute,
}

if (attribute?.isRequired && attribute?.default === undefined) {
if(typeof mergedAttr?.default === 'function') {
mergedAttr.default = mergedAttr.default()
}

if (mergedAttr?.isRequired && mergedAttr?.default === undefined) {
delete mergedAttr.default
}

Expand Down

0 comments on commit bd93a65

Please sign in to comment.