-
Notifications
You must be signed in to change notification settings - Fork 92
[WNMGDS-3350] Remove form components table #3566
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
[WNMGDS-3350] Remove form components table #3566
Conversation
…ce of missing componentVariables
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.
Looks great! Just one non-blocking question
{componentVariables.length > 0 | ||
? componentOptions | ||
: `No variables available for component: "${componentname}".`} | ||
</section> |
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 logic makes sense to me, although I'm not sure how much value the fallback message adds for the end user. Would it make more sense to return null
early if componentVariables.length === 0
to avoid rendering anything at all?
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.
I was between that option and the above code. I think my intent here is to signal something to us devs that this isn't working as expected, and that's because the ComponentThemeOption
component is often rendered below another heading that provides context, and if this is the only thing there, then it makes sense to alert the devs and have them remove the whole section.
But maybe I'm over thinking it and should make it simpler?
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.
I hear you—that makes sense. I don’t have strong feelings about this, so feel free to disregard, but I wonder if there’s a way to split the difference? Maybe return early if it's empty, but issue a console.warn
in development?
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.
Ok, yeah that is the pattern we use for downstream packages. I guess it doesn't make sense to do it a different way for ourselves, but I'm just trying to make sure we don't miss anything, and burying it in the console feels like a way to miss it... I'll go with your suggestion for consistency and maybe I'm over thinking it. Thanks @tamara-corbalt !
@@ -71,8 +71,18 @@ const ComponentThemeOptions = ({ theme, componentname }: ComponentThemeOptionsPr | |||
</Table> | |||
); | |||
|
|||
if (!componentVariables || componentVariables.length == 0) { |
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.
@jack-ryan-nava-pbc can you please add a check for whether the environment is production? I don't think we should be adding a console warning in that case.
Summary
<ComponentThemeOptions componentname="form" />
in our MDX files, and the associated text providing context for those tables.How to test
<ComponentThemeOptions componentname="form" />
in the codebase. There should be 0 results.<ComponentThemeOptions componentname="form" />
to a random MDX page. You should see the messageNo variables available for component: "form".
Happy to discuss whether this is needed or not.Checklist
[WNMGDS-####] Title
or [NO-TICKET] if this is unticketed work.Type
(only one) label for this PR, if it is a breaking change, label should only beType: Breaking
Impacts
, multiple can be selected.