Repository navigation
chore(site): deduplicate CodeSandbox sandbox define-API payload for JS and TS demos - #4467
Merged
RylanBot merged 3 commits intoNov 11, 2026
Merged
Conversation
jadelike-wine
requested review from
HaixingOoO,
NWYLZW,
RylanBot,
ZWkang,
carolin913,
honkinglin and
uyarn
as code owners
November 8, 2026 21:46
Collaborator
TDesign Component Site Preview Open
|
commit: |
RylanBot
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🤔 这个 PR 的性质是?
🔗 相关 Issue
Related to #4465 (docs-site CodeSandbox demo maintenance; this PR addresses the duplicated request-payload code path only).
💡 需求背景和解决方案
Problem:
packages/tdesign-react/site/src/components/codesandbox/index.jsxbuilt the CodeSandboxdefinePOST payload twice — once for TypeScript demos and once for JavaScript demos. The two copies sharepackage.json,public/index.html,src/index.css, and the entry file, so any change to the shared template had to be edited in two places and could drift apart.Solution: The fetch request is now built once. A
fileExtvariable (tsx/jsx, derived fromdemoDom?.currentLangIndex === TypeScriptType) selectssrc/main.<ext>andsrc/demo.<ext>keys, andtsconfig.jsonis conditionally included only for TS demos via a spread. On success the action still openshttps://codesandbox.io/s/<sandbox_id>?file=/src/demo.<ext>.Behavior preserved:
src/main.tsx,src/demo.tsx, plustsconfig.json; JS demos still postsrc/main.jsx,src/demo.jsxwithout it.package.json,public/index.html,src/index.css) are unchanged.Validation: The current PR changes only the CodeSandbox component. The earlier source-inspection test was removed and is not part of this diff. The latest published revision has 12 successful GitHub checks, including the site preview/build checks.
📝 更新日志
tdesign-react
definerequest so the payload is built once for both JS and TS demos@tdesign-react/chat
N/A
☑️ 请求合并前的自查清单