-
Notifications
You must be signed in to change notification settings - Fork 3
JS SDK - Add type Infer for displaySettings #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
JS SDK - Add type Infer for displaySettings #181
Conversation
|
|
e143c50 to
1080571
Compare
f2d10ca to
d1f56e5
Compare
d1f56e5 to
2a93a47
Compare
2a93a47 to
fa2268a
Compare
Feature: CMS-47083
fa2268a to
aae4148
Compare
Feature: CMS-47083
aae4148 to
37d442f
Compare
| }); | ||
|
|
||
| if (!Component) { | ||
| console.log( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed my a previous PR. Maybe rebase the branch again?
| settings: DisplaySettingsType[] | null | undefined, | ||
| templateSettings: Record<string, { editor: string; choices: Record<string, any> }> | ||
| ): Record<string, string> { | ||
| if (!settings || settings.length === 0) return {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return undefined instead of an empty {}.
|
|
||
| const parsedDisplaySettings = template | ||
| ? parseDisplaySettings(node.displaySettings, template.settings) | ||
| : {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again here. We should return undefined if there is no displaySettings returned
| // Assign the value to the key in the result object | ||
| result[item.key] = item.value; | ||
| } | ||
| settings.forEach(s => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the second thought we might not need to do this while parsing. Lets stick to the older way where we just did something like this
for (const item of displaySettings) {
// Assign the value to the key in the result object
result[item.key] = item.value;
}
| return undefined; // Return undefined if displaySettings is not provided | ||
| } | ||
| settings: DisplaySettingsType[] | null | undefined, | ||
| templateSettings: Record<string, { editor: string; choices: Record<string, any> }> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets stick to old way where we take just settings (a displaySettings)
Feature: CMS-47083
Feature: CMS-47083