Repository navigation
Feature/sites secondary development - #2618
Conversation
📝 WalkthroughWalkthroughThe PR adds authenticated site metadata editing across the backend and frontend. It advertises the ChangesBackend site metadata update
Frontend site editing and continuation
Wegent Sites project links
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (6)
wework/src/components/chat/composer/composerLinks.ts (2)
15-18: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer a regex literal over
new RegExpwith escaped strings.The string form requires double escaping and is harder to read. A literal expresses the same pattern.
♻️ Proposed literal
-const MARKDOWN_LINK_REGEX = new RegExp( - '\\[!?([^\\]]*)\\]\\(([a-z][a-z0-9+.-]*:\\/\\/[^\\s)\\]]+)\\)', - 'gi' -) +const MARKDOWN_LINK_REGEX = /\[!?([^\]]*)\]\(([a-z][a-z0-9+.-]*:\/\/[^\s)\]]+)\)/gi🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/components/chat/composer/composerLinks.ts` around lines 15 - 18, Replace the MARKDOWN_LINK_REGEX RegExp constructor with an equivalent regex literal, preserving the current matching behavior and global, case-insensitive flags.
15-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the widened URI-scheme pattern into one shared constant. This PR widens the same scheme sub-pattern
[a-z][a-z0-9+.-]*://in three places. The three copies already diverge: the composer regex accepts an optional leading!, the message regex does not. A future scheme change must be applied three times, and the copies can drift further.
wework/src/components/chat/composer/composerLinks.ts#L15-L18: export the scheme pattern as a shared constant, and buildMARKDOWN_LINK_REGEXfrom it.wework/src/components/chat/MessageList.tsx#L1700-L1700: buildCOMPOSER_LINK_PATTERNfrom the shared constant, and decide whether the optional!prefix should also apply here.wework/src/components/chat/AssistantMarkdown.tsx#L183-L187: replace the inline/^[a-z][a-z0-9+.-]*:\/\//itest with a helper that uses the shared constant.As per coding guidelines: "Before adding code, search for and reuse existing components, services, utilities, and patterns; extract shared logic instead of duplicating it."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/components/chat/composer/composerLinks.ts` around lines 15 - 18, The URI-scheme pattern is duplicated across three locations and must be centralized. In wework/src/components/chat/composer/composerLinks.ts:15-18, export a shared scheme-pattern constant and build MARKDOWN_LINK_REGEX from it; in wework/src/components/chat/MessageList.tsx:1700, build COMPOSER_LINK_PATTERN from that constant and preserve or explicitly align the optional “!” handling; in wework/src/components/chat/AssistantMarkdown.tsx:183-187, replace the inline scheme test with a helper using the shared constant.Source: Coding guidelines
wework/src/features/plugins/pluginTrial.ts (1)
267-281: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRestrict the options type or honor
reference.
queuePluginInputTrialaccepts the fullPluginTrialOptionsbut only readsopenInNewChatandprompt. If a caller passesreference, the function silently ignores it. Narrow the parameter type to the supported fields, or forwardreferencelikequeuePluginTrialdoes.♻️ Proposed narrowing
- { openInNewChat = false, prompt }: PluginTrialOptions = {} + { openInNewChat = false, prompt }: Pick<PluginTrialOptions, 'openInNewChat' | 'prompt'> = {}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/features/plugins/pluginTrial.ts` around lines 267 - 281, Update queuePluginInputTrial so its options parameter type only exposes the supported openInNewChat and prompt fields, preventing callers from passing the ignored reference option; keep the existing queuePendingPluginTrial behavior unchanged.wework/src/features/plugins/pluginTrial.test.ts (1)
196-205: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider asserting the derived templates.
The new path passes
prompt ?? normalizedInputintopluginTrialTemplates. When nopromptis given, the whole Markdown link becomes the selected use case. Add an assertion ontrial?.templatesto lock this behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/features/plugins/pluginTrial.test.ts` around lines 196 - 205, Extend the “queues a custom plugin trial input for a fresh chat” test to assert trial?.templates, verifying that when no prompt is provided the derived template uses the full normalized Markdown-link input as the selected use case.wework/src/pages/SitesPage.tsx (1)
327-387: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify the redundant alias and shorten the function.
pluginis only an alias oflocallyInstalledPluginand adds no meaning. The function is also longer than the preferred 50-line limit. Remove the alias, and consider extracting the target-device resolution into a helper.As per coding guidelines: "functions should remain focused, preferably under 50 lines."
♻️ Proposed cleanup
- const plugin = locallyInstalledPlugin - if (!plugin) { + if (!locallyInstalledPlugin) { setCreateNotice(t('plugin_installing', '正在安装应用插件,完成后将进入会话...')) } - const prepared = plugin - ? { plugin, sync: null } + const prepared = locallyInstalledPlugin + ? { plugin: locallyInstalledPlugin, sync: null } : await pluginApi.ensureBuiltinPluginInstalled(createStrategy.pluginName, { deviceId: targetDeviceId, })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/pages/SitesPage.tsx` around lines 327 - 387, Remove the redundant plugin alias in prepareApplicationPlugin and use locallyInstalledPlugin directly. Extract target-device resolution and its unavailable-device error handling into a focused helper, then call it from prepareApplicationPlugin so the function is reduced below the preferred 50-line limit while preserving existing behavior.Source: Coding guidelines
wework/src/lib/link-preview.test.ts (1)
70-79: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd negative and decoding cases for the new recognizer.
The test covers only the happy path.
WegentSitesProjectRecognizeralso rejects an empty project ID and decodes percent-encoded identifiers. Add cases forwegent-sites-project://and for an encoded ID so both branches stay covered.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/lib/link-preview.test.ts` around lines 70 - 79, Add tests alongside the existing Wegent Sites project link test for WegentSitesProjectRecognizer rejecting the empty URL `wegent-sites-project://` and decoding a percent-encoded project identifier. Assert the empty case is unrecognized and the encoded case produces the decoded label while preserving the expected provider, URL, icon, and abbreviation behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@wework/e2e/desktop/modules/desktop-server.mjs`:
- Line 901: Update the desktop Sites fixture payloads used by the /api/sites
mock to include the required project_id field in both web and mini-program
responses, and add custom_domain_prefix to the web payload. Keep the existing
capabilities and other fixture values unchanged while matching the backend site
response contract.
In `@wework/src/components/sites/ApplicationRows.tsx`:
- Around line 128-141: Update the continue-development button in ApplicationRows
to use a responsive height that provides at least a 44px touch target on mobile
while preserving the existing compact height at larger breakpoints. Keep the
button’s other styling and behavior unchanged.
In `@wework/src/components/sites/EditSiteDialog.tsx`:
- Around line 77-99: Increase mobile touch targets across the affected controls:
in wework/src/components/sites/EditSiteDialog.tsx lines 77-99, apply h-11 to
both inputs and restore compact height with an md: class; in lines 109-127,
apply h-11 min-w-11 to both buttons with md: overrides; and in
wework/src/components/sites/SiteActionsMenu.tsx lines 72-78, apply h-11 w-11 to
the menu trigger with md: overrides. Update the relevant input and button
className values while preserving existing styling.
In `@wework/src/pages/SitesPage.tsx`:
- Around line 461-466: Update the input-missing branch in SitesPage’s
buildSiteContinueDevelopmentInput flow to use a dedicated translation key
describing the missing site project identifier, rather than the plugin
configuration synchronization message. Add the corresponding English and
Simplified Chinese entries under the Wework sites locale namespace, then pass
that key to setCreateError while preserving the existing early return.
- Around line 453-454: Update handleContinueDevelopment and handleCreate to
guard against the other flow’s active state: handleContinueDevelopment must also
reject when creatingType is set, and handleCreate must also reject when
continuingSiteId is set. Preserve each flow’s existing own-state guard and
ensure both flows cannot queue trials, navigate, or clear createNotice
concurrently.
---
Nitpick comments:
In `@wework/src/components/chat/composer/composerLinks.ts`:
- Around line 15-18: Replace the MARKDOWN_LINK_REGEX RegExp constructor with an
equivalent regex literal, preserving the current matching behavior and global,
case-insensitive flags.
- Around line 15-18: The URI-scheme pattern is duplicated across three locations
and must be centralized. In
wework/src/components/chat/composer/composerLinks.ts:15-18, export a shared
scheme-pattern constant and build MARKDOWN_LINK_REGEX from it; in
wework/src/components/chat/MessageList.tsx:1700, build COMPOSER_LINK_PATTERN
from that constant and preserve or explicitly align the optional “!” handling;
in wework/src/components/chat/AssistantMarkdown.tsx:183-187, replace the inline
scheme test with a helper using the shared constant.
In `@wework/src/features/plugins/pluginTrial.test.ts`:
- Around line 196-205: Extend the “queues a custom plugin trial input for a
fresh chat” test to assert trial?.templates, verifying that when no prompt is
provided the derived template uses the full normalized Markdown-link input as
the selected use case.
In `@wework/src/features/plugins/pluginTrial.ts`:
- Around line 267-281: Update queuePluginInputTrial so its options parameter
type only exposes the supported openInNewChat and prompt fields, preventing
callers from passing the ignored reference option; keep the existing
queuePendingPluginTrial behavior unchanged.
In `@wework/src/lib/link-preview.test.ts`:
- Around line 70-79: Add tests alongside the existing Wegent Sites project link
test for WegentSitesProjectRecognizer rejecting the empty URL
`wegent-sites-project://` and decoding a percent-encoded project identifier.
Assert the empty case is unrecognized and the encoded case produces the decoded
label while preserving the expected provider, URL, icon, and abbreviation
behavior.
In `@wework/src/pages/SitesPage.tsx`:
- Around line 327-387: Remove the redundant plugin alias in
prepareApplicationPlugin and use locallyInstalledPlugin directly. Extract
target-device resolution and its unavailable-device error handling into a
focused helper, then call it from prepareApplicationPlugin so the function is
reduced below the preferred 50-line limit while preserving existing behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a0f70086-ce2f-4351-a25d-3de5ada1b04e
📒 Files selected for processing (32)
backend/app/api/endpoints/sites.pybackend/app/schemas/site.pybackend/app/services/site_application_types.pybackend/app/services/sites.pybackend/tests/api/test_sites_api.pydocs/en/wework/developer-guide/wework-codex-plugins.mddocs/zh/wework/developer-guide/wework-codex-plugins.mdwework/e2e/desktop/modules/desktop-server.mjswework/e2e/utils/mock-sites-upstream-server.mjswework/src/App.plugins.test.tsxwework/src/api/sites.test.tswework/src/api/sites.tswework/src/components/chat/AssistantMarkdown.tsxwework/src/components/chat/MessageList.test.tsxwework/src/components/chat/MessageList.tsxwework/src/components/chat/composer/ComposerProseMirrorEditor.test.tsxwework/src/components/chat/composer/composerLinks.tswework/src/components/sites/ApplicationRows.tsxwework/src/components/sites/EditSiteDialog.tsxwework/src/components/sites/SiteActionsMenu.tsxwework/src/components/sites/SitesWorkspace.test.tsxwework/src/components/sites/SitesWorkspace.tsxwework/src/components/sites/applicationTypeDefinitions.test.tsxwework/src/components/sites/applicationTypeDefinitions.tsxwework/src/features/plugins/pluginTrial.test.tswework/src/features/plugins/pluginTrial.tswework/src/i18n/locales/en/sites.jsonwework/src/i18n/locales/zh-CN/sites.jsonwework/src/lib/link-preview.test.tswework/src/lib/link-preview.tswework/src/pages/SitesPage.tsxwework/src/telemetry/events.ts
| enabled: true, | ||
| order: 10, | ||
| capabilities: ['create', 'publish', 'delete'], | ||
| capabilities: ['create', 'publish', 'edit', 'delete'], |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Keep the desktop Sites fixture aligned with the API response contract.
backend/app/schemas/site.py now requires project_id for web and mini-program responses. The /api/sites fixture omits this field from both payloads. The web payload also omits custom_domain_prefix. Add these fields so desktop tests use the same contract as the Backend.
Proposed fixture update
{
app_type: 'miniapp',
siteid: 'prj_e2e_mini',
+ project_id: 'prj_e2e_mini',
taskid: 'prj_e2e_mini',
}
{
app_type: 'web',
siteid: 'prj_e2e_product',
+ project_id: 'prj_e2e_product',
taskid: 'prj_e2e_product',
+ custom_domain_prefix: null,
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| capabilities: ['create', 'publish', 'edit', 'delete'], | |
| { | |
| app_type: 'miniapp', | |
| siteid: 'prj_e2e_mini', | |
| project_id: 'prj_e2e_mini', | |
| taskid: 'prj_e2e_mini', | |
| } | |
| { | |
| app_type: 'web', | |
| siteid: 'prj_e2e_product', | |
| project_id: 'prj_e2e_product', | |
| taskid: 'prj_e2e_product', | |
| custom_domain_prefix: null, | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wework/e2e/desktop/modules/desktop-server.mjs` at line 901, Update the
desktop Sites fixture payloads used by the /api/sites mock to include the
required project_id field in both web and mini-program responses, and add
custom_domain_prefix to the web payload. Keep the existing capabilities and
other fixture values unchanged while matching the backend site response
contract.
| <button | ||
| type="button" | ||
| data-testid={`site-continue-development-${site.siteid}`} | ||
| disabled={deleting || continuing} | ||
| onClick={() => context.onContinueDevelopment(site)} | ||
| className="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-sm font-medium text-text-primary transition-colors hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus/30 disabled:cursor-default disabled:text-text-secondary disabled:opacity-70" | ||
| > | ||
| {continuing ? ( | ||
| <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden="true" /> | ||
| ) : ( | ||
| <Code2 className="h-3.5 w-3.5" aria-hidden="true" /> | ||
| )} | ||
| {t('continue_development', '继续开发')} | ||
| </button> |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Increase the mobile touch target for the new continue-development button.
The button uses a fixed 32px height (h-8). On mobile the row is a single column and this control is reachable by touch. The design rules require at least 44px × 44px for mobile controls. Use a responsive height.
As per coding guidelines: "Mobile controls must be at least 44px × 44px."
♿ Proposed responsive height
- className="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-sm font-medium text-text-primary transition-colors hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus/30 disabled:cursor-default disabled:text-text-secondary disabled:opacity-70"
+ className="flex h-11 min-w-[44px] shrink-0 items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-sm font-medium text-text-primary transition-colors hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus/30 disabled:cursor-default disabled:text-text-secondary disabled:opacity-70 md:h-8"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <button | |
| type="button" | |
| data-testid={`site-continue-development-${site.siteid}`} | |
| disabled={deleting || continuing} | |
| onClick={() => context.onContinueDevelopment(site)} | |
| className="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-sm font-medium text-text-primary transition-colors hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus/30 disabled:cursor-default disabled:text-text-secondary disabled:opacity-70" | |
| > | |
| {continuing ? ( | |
| <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden="true" /> | |
| ) : ( | |
| <Code2 className="h-3.5 w-3.5" aria-hidden="true" /> | |
| )} | |
| {t('continue_development', '继续开发')} | |
| </button> | |
| <button | |
| type="button" | |
| data-testid={`site-continue-development-${site.siteid}`} | |
| disabled={deleting || continuing} | |
| onClick={() => context.onContinueDevelopment(site)} | |
| className="flex h-11 min-w-[44px] shrink-0 items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-sm font-medium text-text-primary transition-colors hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus/30 disabled:cursor-default disabled:text-text-secondary disabled:opacity-70 md:h-8" | |
| > | |
| {continuing ? ( | |
| <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden="true" /> | |
| ) : ( | |
| <Code2 className="h-3.5 w-3.5" aria-hidden="true" /> | |
| )} | |
| {t('continue_development', '继续开发')} | |
| </button> |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wework/src/components/sites/ApplicationRows.tsx` around lines 128 - 141,
Update the continue-development button in ApplicationRows to use a responsive
height that provides at least a 44px touch target on mobile while preserving the
existing compact height at larger breakpoints. Keep the button’s other styling
and behavior unchanged.
Source: Coding guidelines
| <input | ||
| ref={titleInputRef} | ||
| value={title} | ||
| onChange={event => setTitle(event.target.value)} | ||
| data-testid="site-edit-title-input" | ||
| disabled={loading} | ||
| maxLength={255} | ||
| className="mt-1 h-9 w-full rounded-lg border border-border bg-background px-3 text-sm text-text-primary outline-none transition-colors placeholder:text-text-muted focus:border-focus focus:ring-2 focus:ring-focus/15 disabled:cursor-wait disabled:opacity-60" | ||
| /> | ||
| </label> | ||
| <label className="block"> | ||
| <span className="text-xs font-medium text-text-secondary"> | ||
| {t('edit_domain_prefix_label', '自定义域名前缀')} | ||
| </span> | ||
| <input | ||
| value={customDomainPrefix} | ||
| onChange={event => setCustomDomainPrefix(event.target.value.toLowerCase())} | ||
| data-testid="site-edit-domain-prefix-input" | ||
| disabled={loading} | ||
| maxLength={63} | ||
| placeholder={t('edit_domain_prefix_placeholder', '只允许小写字母、数字、短横线')} | ||
| className="mt-1 h-9 w-full rounded-lg border border-border bg-background px-3 text-sm text-text-primary outline-none transition-colors placeholder:text-text-muted focus:border-focus focus:ring-2 focus:ring-focus/15 disabled:cursor-wait disabled:opacity-60" | ||
| /> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Increase mobile touch targets to 44px.
The new edit controls do not meet the required mobile touch-target size. This can prevent reliable interaction on touch devices.
wework/src/components/sites/EditSiteDialog.tsx#L77-L99: useh-11for both inputs on mobile, then restore compact sizing with anmd:class.wework/src/components/sites/EditSiteDialog.tsx#L109-L127: useh-11 min-w-11for both buttons on mobile, then restore compact sizing withmd:classes.wework/src/components/sites/SiteActionsMenu.tsx#L72-L78: useh-11 w-11for the menu trigger on mobile, then restore compact sizing withmd:classes.
As per coding guidelines: “Mobile controls must be at least 44px × 44px.”
📍 Affects 2 files
wework/src/components/sites/EditSiteDialog.tsx#L77-L99(this comment)wework/src/components/sites/EditSiteDialog.tsx#L109-L127wework/src/components/sites/SiteActionsMenu.tsx#L72-L78
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wework/src/components/sites/EditSiteDialog.tsx` around lines 77 - 99,
Increase mobile touch targets across the affected controls: in
wework/src/components/sites/EditSiteDialog.tsx lines 77-99, apply h-11 to both
inputs and restore compact height with an md: class; in lines 109-127, apply
h-11 min-w-11 to both buttons with md: overrides; and in
wework/src/components/sites/SiteActionsMenu.tsx lines 72-78, apply h-11 w-11 to
the menu trigger with md: overrides. Update the relevant input and button
className values while preserving existing styling.
Source: Coding guidelines
| if (continuingSiteId) return | ||
| setContinuingSiteId(site.siteid) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Guard the continuation flow against a concurrent creation flow.
handleContinueDevelopment checks only continuingSiteId, and handleCreate checks only creatingType. The two flows can run at the same time. Both write to the same plugin-trial sessionStorage key through queuePendingPluginTrial, so the second write overwrites the first and one queued trial is lost. Both flows also call navigateTo('/') and clear createNotice in their finally blocks, so the surviving notice state is nondeterministic. Make each flow reject while the other is active.
🐛 Proposed guards
const handleContinueDevelopment = async (
site: Site,
createStrategy: ApplicationCreateStrategy
) => {
- if (continuingSiteId) return
+ if (continuingSiteId || creatingType) return
setContinuingSiteId(site.siteid) const handleCreate = async (appType: SiteAppType, createStrategy: ApplicationCreateStrategy) => {
- if (creatingType) return
+ if (creatingType || continuingSiteId) return
setCreatingType(appType)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wework/src/pages/SitesPage.tsx` around lines 453 - 454, Update
handleContinueDevelopment and handleCreate to guard against the other flow’s
active state: handleContinueDevelopment must also reject when creatingType is
set, and handleCreate must also reject when continuingSiteId is set. Preserve
each flow’s existing own-state guard and ensure both flows cannot queue trials,
navigate, or clear createNotice concurrently.
| if (!input) { | ||
| setCreateError( | ||
| t('plugin_device_sync_failed', '应用插件未能同步到目标设备,请检查设备后重试') | ||
| t('plugin_create_configuration_missing', '应用创建插件配置尚未同步,请刷新后重试') | ||
| ) | ||
| } else { | ||
| setCreateError(t('plugin_install_failed', '应用插件安装失败,请重试')) | ||
| return | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use a message that matches the failure.
buildSiteContinueDevelopmentInput returns null only when the site has neither project_id nor siteid. The current message reports a plugin configuration problem and tells the user to refresh. Refreshing cannot fix a site without a project identifier. Add a dedicated key to both wework/src/i18n/locales/en/sites.json and wework/src/i18n/locales/zh-CN/sites.json, then use it here.
As per coding guidelines: "Add new copy to the appropriate Wework namespace in both src/i18n/locales/en/ and src/i18n/locales/zh-CN/."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wework/src/pages/SitesPage.tsx` around lines 461 - 466, Update the
input-missing branch in SitesPage’s buildSiteContinueDevelopmentInput flow to
use a dedicated translation key describing the missing site project identifier,
rather than the plugin configuration synchronization message. Add the
corresponding English and Simplified Chinese entries under the Wework sites
locale namespace, then pass that key to setCreateError while preserving the
existing early return.
Source: Coding guidelines
Summary by CodeRabbit
New Features
Documentation