Add verification pass for unresolved React components#1289
Conversation
There was a problem hiding this comment.
Hi @WilsonGramer. Thanks for the first PR! We really appreciate your help on this effort.
I'm Requesting changes for two validation gaps that allow unresolved React component paths to pass without an error. Please push up the fixes to these and tag me for a re-review
| }); | ||
|
|
||
| // Verify that paths to React components exist under the correct base directory | ||
| if (studyConfig.baseComponents != null) { |
There was a problem hiding this comment.
baseComponents is optional, so this guard skips validation of the required components object whenever a study does not define any base components. A direct React component with a missing path therefore receives no error. Please remove the outer guard and always iterate both collections using studyConfig[key] ?? {}.
| if ( | ||
| 'path' in component | ||
| && component.path != null | ||
| && component.type === 'react-component' |
There was a problem hiding this comment.
This checks the raw component rather than its resolved inherited shape. A child can inherit type: react-component from its base component while overriding path; because component.type is then undefined here, an unresolved override passes validation. Please merge the referenced base component with the child before checking the effective type and path, as the existing sidebar validation does.
Does this PR close any open issues?
I couldn't find a related issue, but this is a feature request from Lane (@codementum).
Give a longer description of what this PR addresses and why it's needed
This PR adds a pass to
verifyStudyConfigthat checks whether imported React components exist insrc/public/. It uses the same logic to fetch modules as ReactComponentController.tsx. If the module doesn't exist, it suggests to check that the component is insrc/public/and notpublic/.Provide pictures/videos of the behavior before and after these changes (optional)
In demo-react-trrack/config.json, changing the component name to
Missing.tsxproduces this error:Are there any additional TODOs before this PR is ready to go?
TODOs: