v2 Localization#218
Conversation
Author groups — CMS UI, invites, notifications, and permissions
- Introduced new types for title search response and text search items in searchApi.ts. - Updated searchTitles function to validate title length before making API calls. - Refactored MobileView component to conditionally render based on plan publication status and improved iframe integration. - Enhanced SourceSelectorSheet to enforce minimum title search length and provide user feedback for insufficient input.
- Refactored fetchTextDetails function in searchApi.ts to encapsulate query parameters within a params object for improved clarity and maintainability.
… related components - Enhanced the formatting of the searchTitles function in searchApi.ts for better readability. - Adjusted the Chinese language label in dashboardTableUi.tsx for consistent indentation. - Updated MobilePreviewSplitDivider.tsx to streamline button attributes. - Refactored SourceSelectorSheet.tsx to improve the clarity of the sources memoization logic.
Confidence Score: 3/5Safe to merge for non-published plans; published-plan users will always open with the mobile preview collapsed and must manually reveal it on every page load. The showMobilePreview useEffect fires during the loading phase when isPlanPublished is still false, locking the preview as hidden. When data resolves and the plan is published, the effect no longer corrects the state. This silently breaks the expected default-open behaviour for every published plan visit. PlanDetailsPage.tsx — the showMobilePreview initialisation and its controlling useEffect need attention. Reviews (1): Last reviewed commit: "refactor(api): improve formatting and re..." | Re-trigger Greptile |
| useEffect(() => { | ||
| if (!isPlanPublished) { | ||
| setShowMobilePreview(false); | ||
| } | ||
| }, [isPlanPublished]); |
There was a problem hiding this comment.
Mobile preview always starts hidden for published plans
On the first render planDetails is still loading, so isPlanPublished evaluates to false. The effect immediately fires and sets showMobilePreview to false. When the query resolves and isPlanPublished flips to true, the if (!isPlanPublished) branch is skipped — leaving showMobilePreview permanently false. Every visit to a published plan will therefore open with the preview hidden, contradicting the useState(true) intent and forcing users to manually reveal it every time.
| <p>Keep typing to search</p> | ||
| <span className="dark:text-[#b1b1b1] text-gray-600"> | ||
| Enter at least {MIN_TITLE_SEARCH_LENGTH} characters to search titles | ||
| </span> |
There was a problem hiding this comment.
These two strings are hardcoded in English. The file already imports
useTranslate and uses t() elsewhere (e.g. t("common.placeholder.search")), so they should go through the translation pipeline — especially in a localization PR.
| <p>Keep typing to search</p> | |
| <span className="dark:text-[#b1b1b1] text-gray-600"> | |
| Enter at least {MIN_TITLE_SEARCH_LENGTH} characters to search titles | |
| </span> | |
| <p>{t("sourceSelector.keepTyping")}</p> | |
| <span className="dark:text-[#b1b1b1] text-gray-600"> | |
| {t("sourceSelector.minCharsHint", { count: MIN_TITLE_SEARCH_LENGTH })} | |
| </span> |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
No description provided.