add support for mainComponentPath#243
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| png_width: "800", | ||
| png_height: "600", | ||
| fs_map: encodeURIComponent(encodedFsMap), | ||
| main_component_path: mainComponentPath | ||
| ? encodeURIComponent(mainComponentPath) | ||
| : undefined, | ||
| project_base_url: encodeURIComponent(projectBaseUrl), | ||
| } | ||
| const queryString = Object.entries(params) |
There was a problem hiding this comment.
Avoid sending undefined main_component_path parameter
When mainComponentPath is not provided, the new query params object still includes main_component_path with a value of undefined, because the subsequent Object.entries(params)/map logic stringifies the property instead of omitting it. Existing CircuitPreview usages that do not specify mainComponentPath will now request the 3D preview with main_component_path=undefined, which can cause the backend to look for a file literally named "undefined" rather than falling back to the default entrypoint. Filter out undefined values before building the query string so that the parameter is only sent when a path is supplied.
Useful? React with 👍 / 👎.
No description provided.