Skip to content

Add verification pass for unresolved React components#1289

Open
WilsonGramer wants to merge 1 commit into
revisit-studies:devfrom
WilsonGramer:verify-unresolved-react-components
Open

Add verification pass for unresolved React components#1289
WilsonGramer wants to merge 1 commit into
revisit-studies:devfrom
WilsonGramer:verify-unresolved-react-components

Conversation

@WilsonGramer

Copy link
Copy Markdown

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 verifyStudyConfig that checks whether imported React components exist in src/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 in src/public/ and not public/.

Provide pictures/videos of the behavior before and after these changes (optional)

In demo-react-trrack/config.json, changing the component name to Missing.tsx produces this error:

verify-unresolved-react-components

Are there any additional TODOs before this PR is ready to go?

TODOs:

  • Other component types?

@JackWilb JackWilb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/parser/parser.ts
});

// Verify that paths to React components exist under the correct base directory
if (studyConfig.baseComponents != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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] ?? {}.

Comment thread src/parser/parser.ts
if (
'path' in component
&& component.path != null
&& component.type === 'react-component'

@JackWilb JackWilb Jul 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants