GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(diagnosis): polish smart job explorer flow by longdevlife · Pull Request #177 · SkillBridgeExe/skillbridge-fe-official Conversation
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughPR mở rộng đề xuất việc làm với bộ lọc, vị trí và snapshot token. PR bổ sung credit package, voucher credit và số dư credit. PR thay đổi luồng phân tích CV, cập nhật giao diện chẩn đoán, bản dịch và manual chunks của Vite. ChangesĐề xuất việc làm và chẩn đoán
Billing và credit
Phân tích CV
Bản dịch và build
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant DiagnosisStep1Upload
participant analyzeCvWithJd
participant analyzeCvApi
participant DiagnosisEndpoint
DiagnosisStep1Upload->>analyzeCvWithJd: Gửi CV, role và JD
analyzeCvWithJd->>analyzeCvApi: Gọi orchestration backend
analyzeCvApi->>DiagnosisEndpoint: Upload và phân tích CV
DiagnosisEndpoint-->>analyzeCvWithJd: Trả trạng thái và kết quả match
analyzeCvWithJd-->>DiagnosisStep1Upload: Trả kết quả phân tích
sequenceDiagram
participant BillingMe
participant billingService
participant BillingEndpoint
participant QueryClient
BillingMe->>billingService: Chuẩn hóa và gửi voucher
billingService->>BillingEndpoint: POST claim voucher
BillingEndpoint-->>BillingMe: Trả loại credit và số lượng
BillingMe->>QueryClient: Invalidate BILLING_CREDITS
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
src/components/diagnosis/DiagnosisStep3Results.tsx (1)
699-709: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winLoại bỏ các mã màu hex còn lại.
Các giá trị
#e2e8f0,#64748b,#0ea5e9và#F8FAFCvẫn hard-code màu. Dùng token màu semantic qua CSS variables hoặc cấu hình màu dùng chung để hoàn thành mục tiêu PR.
src/components/diagnosis/DiagnosisStep3Results.tsx#L699-L709: Thay các màu của radar, trục, tooltip và chú giải.src/components/diagnosis/report/ScoreRail.tsx#L207-L207: Thay màu nền vòng donut.🤖 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 `@src/components/diagnosis/DiagnosisStep3Results.tsx` around lines 699 - 709, Replace the remaining hard-coded hex colors in the radar chart, axes, tooltip, and legend within DiagnosisStep3Results.tsx lines 699-709 with the project’s semantic color tokens or shared CSS variables, preserving the existing visual roles. Also replace the donut background color in ScoreRail.tsx line 207 using the same shared token approach.src/components/diagnosis/JobRecommendations.tsx (2)
75-145: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueBỏ kiểm tra
!datakhông cần thiết.Prop
datacó kiểuJobRecommendationsResponse(không nullable) và call site tại dòng 577 đã kiểm tradata. Dòng 76 là code chết.♻️ Đề xuất thay đổi
function JobMarketSummary({ data, t }: { data: JobRecommendationsResponse; t: (key: string, options?: Record<string, unknown>) => string }) { - if (!data) return null; const { total, facets, role_scope, pool_size, eligible_pool_size } = data;🤖 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 `@src/components/diagnosis/JobRecommendations.tsx` around lines 75 - 145, Remove the unnecessary `if (!data) return null;` guard at the start of `JobMarketSummary`, since its `data` prop is typed as non-nullable and the caller already validates it. Leave the remaining summary calculations and rendering unchanged.
1152-1165: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRetry không phân biệt loại lỗi. Handler retry xóa
snapshotTokencho mọi lỗi, không chỉ khi snapshot hết hạn. Test tương ứng vì vậy cũng không chứng minh được hành vi riêng cho 410.
src/components/diagnosis/JobRecommendations.tsx#L1152-L1165: chỉ xóa token khi status là 410, và gọirefetch()cho các lỗi khác.src/components/diagnosis/job-recommendations.spec.tsx#L453-L492: thêm case lỗi 500 để xác nhận token được giữ vàrefetchđược gọi.🤖 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 `@src/components/diagnosis/JobRecommendations.tsx` around lines 1152 - 1165, Update the retry handler in JobRecommendations to remove snapshotToken only when the error status is 410; for all other errors, retain the token and call refetch(). Extend the retry tests in src/components/diagnosis/job-recommendations.spec.tsx:453-492 with a 500-error case verifying the token remains and refetch is invoked, while preserving the existing 410 coverage.
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 `@src/components/diagnosis/CvBreakdownPopover.tsx`:
- Around line 28-31: Update the small-text color values in CvBreakdownPopover’s
breakdown configuration to improve contrast: change sky-600 to sky-700,
orange-600 to orange-700, and any text-slate-400 used by the component to
text-slate-600, while preserving the existing labels, scores, icons, and
backgrounds.
In `@src/components/diagnosis/DiagnosisInsights.tsx`:
- Line 103: Thêm lớp `group` vào chuỗi class của thẻ `li` trong hàng hành động
của DiagnosisInsights để selector `group-hover:border-slate-400` trên checkbox
hoạt động khi hover toàn bộ hàng.
- Line 120: Update the completed-action styling in DiagnosisInsights around the
isTicked class expression: retain line-through and font-medium, but replace
text-slate-300 with text-slate-600 to improve contrast on light backgrounds.
---
Nitpick comments:
In `@src/components/diagnosis/DiagnosisStep3Results.tsx`:
- Around line 699-709: Replace the remaining hard-coded hex colors in the radar
chart, axes, tooltip, and legend within DiagnosisStep3Results.tsx lines 699-709
with the project’s semantic color tokens or shared CSS variables, preserving the
existing visual roles. Also replace the donut background color in ScoreRail.tsx
line 207 using the same shared token approach.
In `@src/components/diagnosis/JobRecommendations.tsx`:
- Around line 75-145: Remove the unnecessary `if (!data) return null;` guard at
the start of `JobMarketSummary`, since its `data` prop is typed as non-nullable
and the caller already validates it. Leave the remaining summary calculations
and rendering unchanged.
- Around line 1152-1165: Update the retry handler in JobRecommendations to
remove snapshotToken only when the error status is 410; for all other errors,
retain the token and call refetch(). Extend the retry tests in
src/components/diagnosis/job-recommendations.spec.tsx:453-492 with a 500-error
case verifying the token remains and refetch is invoked, while preserving the
existing 410 coverage.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: eba9966f-d880-4232-9438-ad521da6bdd4
shared/api.tssrc/api/cv/recommendations.tssrc/components/diagnosis/AiTrendsInsight.tsxsrc/components/diagnosis/AtsBreakdownPopover.tsxsrc/components/diagnosis/CvBreakdownPopover.tsxsrc/components/diagnosis/DiagnosisInsights.tsxsrc/components/diagnosis/DiagnosisInspectMode.tsxsrc/components/diagnosis/DiagnosisIssueTracker.tsxsrc/components/diagnosis/DiagnosisStep3Results.tsxsrc/components/diagnosis/JobRecommendations.tsxsrc/components/diagnosis/TailorChecklist.tsxsrc/components/diagnosis/job-recommendations.spec.tsxsrc/components/diagnosis/report/ScoreRail.tsxsrc/i18n/locales/cv-diagnosis-i18n.spec.tssrc/i18n/locales/en.tssrc/i18n/locales/vi.tsvite.config.ts
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| onClick={() => toggleTick(idx)} | ||
| className={cn( | ||
| "flex items-start gap-3.5 text-sm text-[#2F3437] p-3 rounded-xl border border-transparent hover:border-[#F1F1EF] hover:bg-slate-50/50 transition-all duration-200 cursor-pointer select-none", | ||
| "flex items-start gap-3.5 text-sm text-slate-900 p-3 rounded-xl border border-transparent hover:border-slate-100 hover:bg-slate-50/50 transition-all duration-200 cursor-pointer select-none", |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "Locate file:" git ls-files | rg 'src/components/diagnosis/DiagnosisInsights\.tsx$' || true echo echo "Relevant lines:" sed -n '80,125p' src/components/diagnosis/DiagnosisInsights.tsx | cat -n echo echo "Check Tailwind group/group-hover usage in file:" rg -n 'group|group-hover|flex items-start gap-3\.5|text-slate-300' src/components/diagnosis/DiagnosisInsights.tsx || true echo echo "Verify Tailwind plugins/config availability:" git ls-files | rg '(^|/)tailwind\.config\.(js|ts|mjs|cjs)$|postcss\.config\.(js|mjs|cjs)$|package\.json$' || true if [ -f package.json ]; then echo; cat package.json | sed -n '1,180p'; fi if [ -f postcss.config.mjs ]; then echo; cat postcss.config.mjs; fi if [ -f src/index.css ]; then echo; cat src/index.css | sed -n '1,80p'; fi
Repository: SkillBridgeExe/skillbridge-fe-official
Length of output: 8206
🌐 Web query:
Tailwind CSS group-hover requires parent has group modifier
💡 Result:
Yes, Tailwind CSS group-hover requires that a parent element be marked with the group class to function [1][2]. When you use the group-hover utility on a descendant element, Tailwind applies the styles only when the closest ancestor marked with the group class is in a hovered state [1][3][2]. Key points regarding the group modifier: - Marking the Parent: You must add the class group to the parent element you wish to monitor [1][4][2]. - Targeting Descendants: You can then use the group-hover: prefix on any child or deeply nested descendant element [1][2][5]. - Nested Groups: If you have nested groups, you can distinguish between them by naming them using the group/{name} syntax on the parent and targeting them with group-hover/{name} on the descendant [1][6][5]. - Other States: This pattern works with other pseudo-class modifiers as well, such as group-focus, group-active, and group-odd [1][6][2]. This mechanism allows you to create interactive components where styles change on child elements based on the state of a parent container without needing to write custom CSS [6][2].
Citations:
Thêm lớp group cho hàng hành động.
group-hover:border-slate-400 ở checkbox chỉ xét hover trên tổ tiên có lớp group; hàng mục hiện không có lớp đó. Hãy thêm group vào chuỗi class của thẻ li để viền checkbox đổi màu khi hover hàng.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/diagnosis/DiagnosisInsights.tsx` at line 103, Thêm lớp `group`
vào chuỗi class của thẻ `li` trong hàng hành động của DiagnosisInsights để
selector `group-hover:border-slate-400` trên checkbox hoạt động khi hover toàn
bộ hàng.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…tions and close UI gaps
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
src/components/diagnosis/job-recommendations.spec.tsx (1)
432-535: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick winChặn query tokenless trung gian khi response đầu tiên có
snapshot_token.
JobRecommendations.tsxlưu token vàoqueryState; ở Top 5,activeQueryngay lập tức thêmsnapshotTokenvào query.useJobRecommendationsQuerydùng toàn bộquerytrongqueryKey, nên key thay đổi và React Query chạy lạigetJobRecommendationscho cùng snapshot. Test hiện kiểm tra Explorer toggle sẽ bỏ qua call trung gian này. Thêm assertion rằng sau response có token và trước thao tác người dùng chỉ có call không token; hoặc seeding cache cho query có token trước khi set state, và chỉ thêm token vào query khi người dùng đổi view/bộ lọc/sắp xếp/trang.🤖 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 `@src/components/diagnosis/job-recommendations.spec.tsx` around lines 432 - 535, Prevent the intermediate tokenless query in the JobRecommendations flow: update activeQuery/queryState handling so receiving generation.snapshot_token does not immediately change the useJobRecommendationsQuery key and refetch the same snapshot. Add snapshotToken only after a user-initiated view, filter, sort, or pagination change, or seed the tokenized query cache before updating state; extend the pagination stability test to assert no tokenized call occurs before user interaction.
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 `@src/components/diagnosis/DiagnosisStep1Upload.tsx`:
- Line 105: Update DiagnosisStep1Upload and its useDiagnosisRolesQuery usage to
capture refetch, then render a translated retry button in the existing
roles-error UI around the error message. Wire the button to refetch the
diagnosis roles so users can recover from loading failures and select targetRole
without changing the existing loading or success states.
---
Outside diff comments:
In `@src/components/diagnosis/job-recommendations.spec.tsx`:
- Around line 432-535: Prevent the intermediate tokenless query in the
JobRecommendations flow: update activeQuery/queryState handling so receiving
generation.snapshot_token does not immediately change the
useJobRecommendationsQuery key and refetch the same snapshot. Add snapshotToken
only after a user-initiated view, filter, sort, or pagination change, or seed
the tokenized query cache before updating state; extend the pagination stability
test to assert no tokenized call occurs before user interaction.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d4e11fd7-5605-4da6-bdc5-72fc2985665d
shared/api.tssrc/api/cv/diagnosis-roles.tssrc/components/companion/CompanionShell.tsxsrc/components/diagnosis/AtsBreakdownPopover.tsxsrc/components/diagnosis/CvBreakdownPopover.tsxsrc/components/diagnosis/DiagnosisStep1Upload.tsxsrc/components/diagnosis/DiagnosisStep3Results.tsxsrc/components/diagnosis/FitBadge.tsxsrc/components/diagnosis/InfoPopover.tsxsrc/components/diagnosis/JobRecommendations.tsxsrc/components/diagnosis/ScoreBreakdownPopover.tsxsrc/components/diagnosis/diagnosis-step-1-upload.spec.tsxsrc/components/diagnosis/job-recommendations.spec.tsxsrc/hooks/use-diagnosis-roles.tssrc/i18n/locales/en.tssrc/i18n/locales/vi.ts
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| const isAuthenticated = useAuthStore((state) => state.isAuthenticated); | ||
| const hasApiSession = useHasApiSession(); | ||
| const { data: rubricRoles = [], isLoading: isRolesLoading, isError: isRolesError } = useDiagnosisRolesQuery(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Thêm cơ chế thử lại khi tải vai trò lỗi.
Khi truy vấn lỗi, Line 524-529 chỉ hiển thị thông báo. Người dùng không thể chọn targetRole, nên hành động phân tích vẫn bị khóa ở Line 601-608. Lấy refetch từ useDiagnosisRolesQuery và hiển thị nút thử lại có nhãn đã dịch.
Also applies to: 524-529
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/diagnosis/DiagnosisStep1Upload.tsx` at line 105, Update
DiagnosisStep1Upload and its useDiagnosisRolesQuery usage to capture refetch,
then render a translated retry button in the existing roles-error UI around the
error message. Wire the button to refetch the diagnosis roles so users can
recover from loading failures and select targetRole without changing the
existing loading or success states.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
src/components/diagnosis/JobRecommendations.tsx (2)
212-224: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDùng
fallbackLocationkhi structured location không có giá trị hiển thị.Khi
locationskhông rỗng nhưng bản ghi chỉ chứa giá trịnullhoặc chuỗi trống, nhánh legacy không chạy.formatLocationDisplaytrả vềjobs.unknownLocationvà che khuấtfallbackLocationhợp lệ. Chỉ dùng structured location khi có ít nhất một phần hiển thị được; nếu không, dùngfallbackLocationtrướcunknownLocation.🤖 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 `@src/components/diagnosis/JobRecommendations.tsx` around lines 212 - 224, Update JobLocationsBadge to verify that the selected structured location contains at least one non-empty displayable value before using formatLocationDisplay. If all entries are null or blank, fall back to fallbackLocation first and t("jobs.unknownLocation") only when no fallback exists; preserve the existing structured-location rendering when valid data is present.
514-514: 🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy liftKhông thêm
snapshotTokenvào query key ngay sau response đầu tiên.Chuỗi Top 5 hiện bắt đầu bằng query không token. Khi
data.generation.snapshot_tokenđược lưu vàoqueryState,activeQueryvàqueryKeythay đổi ngay lập tức; React Query sẽ trigger query tokenized trước khi người dùng thay đổi bộ lọc trang hoặc click "Tải thêm". Chỉ đưa token vào query kế tiếp do người dùng thay đổi, hoặc seed cache tokenized cho query hiện tại; đồng thời kiểm tra rằng sau lần tải đầu tiên không xuất thêm HTTP request.🤖 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 `@src/components/diagnosis/JobRecommendations.tsx` at line 514, The snapshotToken is being added to the queryKey immediately after the first response is received, causing React Query to refetch with the updated key before any user action. Remove the snapshotToken from the current query key construction around line 514 and instead defer adding it until a subsequent query is triggered by user changes (such as filter or pagination updates). Verify that no additional HTTP request is triggered after the initial load completes.Source: Path instructions
src/components/diagnosis/job-recommendations.spec.tsx (3)
680-683: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winKhông dùng
as anyđể che giấu nullable location contract.Fixture này chứng minh API có thể trả
city_code: null, nhưng cast hiện bỏ qua kiểm tra củaJobLocationDisplay. Cập nhậtshared/api.tsđể biểu diễn field nullable, rồi bỏ cast. Nếu type đã cho phépnull, chỉ cần bỏ cast để compiler tiếp tục kiểm tra fixture.As per path instructions, cần ưu tiên type-safety và các contract giữa API với component; nhận định này cần đối chiếu
shared/api.ts.🤖 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 `@src/components/diagnosis/job-recommendations.spec.tsx` around lines 680 - 683, Update the location type in shared/api.ts to declare city_code and district_code as nullable where the API permits null, then remove the as any cast from the locations fixture in job-recommendations.spec.tsx. Preserve JobLocationDisplay’s compile-time validation by relying on the corrected API contract.Source: Path instructions
674-698: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winKiểm tra đúng nhánh loại bỏ chuỗi
"null".
city_code: nulllàm điều kiệnloc.city_code?.trim()dừng sớm. Vì vậy,localizedCitykhông thể trả về chuỗi"null"và điều kiệncity !== "null"chưa được kiểm tra. Một regression xóa guard này vẫn có thể vượt qua test. Dùng city code không rỗng với kết quả localization là"null", rồi xác nhận giá trị đó không được render.🤖 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 `@src/components/diagnosis/job-recommendations.spec.tsx` around lines 674 - 698, Update the test “does not render 'null' string when city_code is null” to exercise the guard that rejects a localized city value of "null": provide a non-empty city_code and mock or configure localization to return "null", then assert that "null" is not rendered while the valid location text remains visible.
622-672: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winBổ sung fixture cho các nhánh mà tên test mô tả.
Test tại Lines 622-647 chỉ dùng ba phần địa điểm khác nhau, nên không kiểm tra deduplication. Test tại Lines 649-672 không có chuỗi trống, nên không kiểm tra blank-value filtering. Thêm một giá trị trùng khác kiểu chữ và ít nhất một trường chứa chuỗi trống. Xác nhận kết quả cuối không chứa phần trùng hoặc phần rỗng.
🤖 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 `@src/components/diagnosis/job-recommendations.spec.tsx` around lines 622 - 672, Bổ sung fixture cho hai test trong nhóm “structured locations rendering”: ở test “renders exact address, district, and city combined, deduplicated”, thêm một giá trị địa điểm trùng nhưng khác kiểu chữ và kiểm tra kết quả chỉ hiển thị một lần; ở test “falls back to district and city…”, thêm ít nhất một trường chứa chuỗi rỗng và xác nhận output không chứa phần rỗng, đồng thời vẫn giữ đúng địa chỉ, quận và thành phố hợp lệ.src/components/diagnosis/JobRecommendations.tsx (1)
196-210: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThay
t: anybằng kiểu translator hẹp.
formatLocationDisplayhiện tắt kiểm tra kiểu cho toàn bộ lời gọit. Dùng kiểu translator đã có từuseTranslation, hoặc khai báo một interface hẹp cho các tham số và giá trị trả về.As per path instructions, cần ưu tiên các lỗ hổng type-safety trong mã TypeScript.
🤖 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 `@src/components/diagnosis/JobRecommendations.tsx` around lines 196 - 210, Replace the any type of the t parameter in formatLocationDisplay with the existing translator type from useTranslation, or define a narrow translator interface covering its calls and return value. Keep the function’s localization behavior unchanged while restoring type safety.Source: Path instructions
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/components/diagnosis/JobRecommendations.tsx`:
- Around line 212-224: Update JobLocationsBadge to verify that the selected
structured location contains at least one non-empty displayable value before
using formatLocationDisplay. If all entries are null or blank, fall back to
fallbackLocation first and t("jobs.unknownLocation") only when no fallback
exists; preserve the existing structured-location rendering when valid data is
present.
- Line 514: The snapshotToken is being added to the queryKey immediately after
the first response is received, causing React Query to refetch with the updated
key before any user action. Remove the snapshotToken from the current query key
construction around line 514 and instead defer adding it until a subsequent
query is triggered by user changes (such as filter or pagination updates).
Verify that no additional HTTP request is triggered after the initial load
completes.
---
Nitpick comments:
In `@src/components/diagnosis/job-recommendations.spec.tsx`:
- Around line 680-683: Update the location type in shared/api.ts to declare
city_code and district_code as nullable where the API permits null, then remove
the as any cast from the locations fixture in job-recommendations.spec.tsx.
Preserve JobLocationDisplay’s compile-time validation by relying on the
corrected API contract.
- Around line 674-698: Update the test “does not render 'null' string when
city_code is null” to exercise the guard that rejects a localized city value of
"null": provide a non-empty city_code and mock or configure localization to
return "null", then assert that "null" is not rendered while the valid location
text remains visible.
- Around line 622-672: Bổ sung fixture cho hai test trong nhóm “structured
locations rendering”: ở test “renders exact address, district, and city
combined, deduplicated”, thêm một giá trị địa điểm trùng nhưng khác kiểu chữ và
kiểm tra kết quả chỉ hiển thị một lần; ở test “falls back to district and
city…”, thêm ít nhất một trường chứa chuỗi rỗng và xác nhận output không chứa
phần rỗng, đồng thời vẫn giữ đúng địa chỉ, quận và thành phố hợp lệ.
In `@src/components/diagnosis/JobRecommendations.tsx`:
- Around line 196-210: Replace the any type of the t parameter in
formatLocationDisplay with the existing translator type from useTranslation, or
define a narrow translator interface covering its calls and return value. Keep
the function’s localization behavior unchanged while restoring type safety.
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7f327c4a-bfea-4e30-be3c-9a943a6bc2b7
shared/api.tssrc/components/diagnosis/JobRecommendations.tsxsrc/components/diagnosis/job-recommendations.spec.tsxsrc/i18n/locales/en.tssrc/i18n/locales/vi.ts
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- Add support for credit vouchers in admin voucher form validation and payload building. - Implement tests for credit voucher validation and payload generation. - Update BillingCheckoutStatus to handle credit package actions and display appropriate CTAs. - Introduce BillingMe component to manage credit voucher claims and display credit balances. - Enhance Pricing component to include credit package purchasing functionality. - Add new services for managing credit packages and claiming vouchers. - Implement analyze CV with JD functionality to handle credit usage in diagnosis service.
…t, trailing whitespaces, mobile filters, IT_ROLES hardcode)
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
src/components/diagnosis/JobRecommendations.tsx (1)
591-598: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winĐảm bảo không tải lại khi nhận snapshot mới.
useJobRecommendationsQuerylấy toàn bộqueryvàoqueryKey, trong khi effect capture snapshot lại ghi vàoqueryState.snapshotToken. Nếu query không có token đang dùng, việc add token vào state sẽ sinh query key mới và phát request thứ hai cho cùng bộ lọc trang hiện có. Thêm regression test cho luồng HTTP 410 → Retry, với mock response mới trả token và assert không gọi hook một lần nữa cho cùng bộ lọc cùng trang.🤖 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 `@src/components/diagnosis/JobRecommendations.tsx` around lines 591 - 598, Điều chỉnh luồng giữa useEffect capture snapshot và useJobRecommendationsQuery để việc ghi snapshotToken mới không tạo queryKey mới rồi gửi lại request cho cùng bộ lọc và trang hiện tại; chỉ dùng token cho các truy vấn tiếp theo khi cần. Bổ sung regression test cho luồng HTTP 410 → Retry, mock response retry có snapshot token và xác nhận hook không bị gọi lại cho cùng bộ lọc cùng trang.
src/services/diagnosis.service.spec.ts (1)
179-220: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThêm test cho kết quả
ANALYZED.Line 179 đến Line 220 chỉ kiểm tra hai nhánh phục hồi lỗi. Thêm một mock có
status: "ANALYZED"vàmatchhợp lệ. Xác nhậnreview.jdMatchnhận kết quả từmapMatchDtoToJdMatch.🤖 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 `@src/services/diagnosis.service.spec.ts` around lines 179 - 220, Add an “ANALYZED” success-case test alongside the existing analyzeCvWithJd tests, mocking analyzeCvApi with a valid match and reviewed CV data. Assert the returned outcome is ANALYZED and that review.jdMatch contains the mapped match result produced through mapMatchDtoToJdMatch.
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 `@src/api/cv/analysis.ts`:
- Around line 32-35: Remove the manually specified “Content-Type” header from
the httpClient.post call for API_ROUTES.DIAGNOSIS.CV_ANALYSIS, leaving Axios or
the browser to generate the multipart/form-data header and boundary for the
FormData payload. Keep the existing timeout and request behavior unchanged.
In `@src/components/diagnosis/JobRecommendations.tsx`:
- Around line 533-544: Keep the setQueryState updater callback in the useEffect
pure by computing the next query value before calling it. When the query
changes, invoke setAccumulatedRecs([]) outside the updater callback, while
preserving the existing query, offset reset, debounce, and explorer-open
behavior.
In `@src/lib/api-error.ts`:
- Around line 42-52: Update isTechnicalMessage to normalize and remove trailing
punctuation before testing the existing technical-message patterns, so messages
such as “Internal server error.” and status-code messages ending in a period
still match. Add corresponding period-terminated cases to api-error.spec.ts
while preserving the current fallback behavior.
In `@src/pages/admin/AdminBillingPlans.tsx`:
- Around line 415-423: Update the new-plan flow around the category SelectField
and toCreatePayload to include CREDIT_PACKAGE as a selectable category. When
category is CREDIT_PACKAGE, include creditUnits in the creation payload; keep
quota excluded for credit packages. Preserve the existing payload behavior for
SUBSCRIPTION and MENTOR_PACKAGE.
---
Outside diff comments:
In `@src/components/diagnosis/JobRecommendations.tsx`:
- Around line 591-598: Điều chỉnh luồng giữa useEffect capture snapshot và
useJobRecommendationsQuery để việc ghi snapshotToken mới không tạo queryKey mới
rồi gửi lại request cho cùng bộ lọc và trang hiện tại; chỉ dùng token cho các
truy vấn tiếp theo khi cần. Bổ sung regression test cho luồng HTTP 410 → Retry,
mock response retry có snapshot token và xác nhận hook không bị gọi lại cho cùng
bộ lọc cùng trang.
---
Nitpick comments:
In `@src/services/diagnosis.service.spec.ts`:
- Around line 179-220: Add an “ANALYZED” success-case test alongside the
existing analyzeCvWithJd tests, mocking analyzeCvApi with a valid match and
reviewed CV data. Assert the returned outcome is ANALYZED and that
review.jdMatch contains the mapped match result produced through
mapMatchDtoToJdMatch.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b497e047-e8f6-43f4-9945-7ad234a3b238
shared/api.tssrc/api/admin-billing.tssrc/api/billing.tssrc/api/core/http-client.tssrc/api/cv/analysis.tssrc/api/cv/recommendations.spec.tssrc/api/cv/recommendations.tssrc/components/billing/QuotaUpgradeListener.tsxsrc/components/diagnosis/DiagnosisStep1Upload.tsxsrc/components/diagnosis/JobRecommendations.tsxsrc/components/diagnosis/diagnosis-step-1-upload.spec.tsxsrc/components/diagnosis/job-recommendations.spec.tsxsrc/constants/api-routes.tssrc/constants/app.tssrc/hooks/use-interview.tssrc/i18n/locales/en.tssrc/i18n/locales/vi.tssrc/lib/api-error.spec.tssrc/lib/api-error.tssrc/lib/billing-error.spec.tssrc/lib/billing-error.tssrc/pages/admin/AdminBillingPlans.spec.tsxsrc/pages/admin/AdminBillingPlans.tsxsrc/pages/admin/AdminBillingVouchers.tsxsrc/pages/admin/admin-voucher-form.spec.tssrc/pages/admin/admin-voucher-form.tssrc/pages/user/BillingCheckoutStatus.spec.tsxsrc/pages/user/BillingCheckoutStatus.tsxsrc/pages/user/BillingMe.spec.tsxsrc/pages/user/BillingMe.tsxsrc/pages/user/Interview.tsxsrc/pages/user/Pricing.spec.tsxsrc/pages/user/Pricing.tsxsrc/services/admin-billing.service.tssrc/services/billing.service.tssrc/services/diagnosis.service.spec.tssrc/services/diagnosis.service.ts
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| httpClient.post(API_ROUTES.DIAGNOSIS.CV_ANALYSIS, formData, { | ||
| timeout: CV_AI_TIMEOUT_MS, | ||
| headers: { "Content-Type": "multipart/form-data" }, | ||
| }), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== files ==" git ls-files | rg '(^|/)analysis\.ts$|axios|api|HttpClient|apiClient' || true echo "== target file ==" if [ -f src/api/cv/analysis.ts ]; then wc -l src/api/cv/analysis.ts cat -n src/api/cv/analysis.ts else echo "missing" fi echo "== httpClient definitions/usages ==" rg -n "httpClient|axios|axiosInstance|create.*HttpClient|defaultHeaders|Content-Type|multipart/form-data|FormData" src -S || true
Repository: SkillBridgeExe/skillbridge-fe-official
Length of output: 50394
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== http-client relevant sections ==" sed -n '1,115p' src/api/core/http-client.ts | cat -n echo "---" sed -n '140,185p' src/api/core/http-client.ts | cat -n echo "== axios version ==" if [ -f package.json ]; then jq -r '.dependencies.axios, .devDependencies.axios' package.json fi echo "== browser-native FormData behavior probe ==" node - <<'JS' const body = new FormData(); body.append('file', new File(['x'], 'x.pdf', { type: 'application/pdf' })); body.append('targetRole', 'developer'); function tryHeader() { try { const headers = new Headers({ 'Content-Type': 'multipart/form-data' }); return { ok: true, value: headers.get('Content-Type') ?? headers.get('content-type') }; } catch (error) { return { ok: false, message: error?.message }; } } console.log(JSON.stringify({ formDataSeenByBrowserCore: 'FormData payload, Content-Type omitted by fetch', manualMultipartHeaderSetting: tryHeader() })); JS echo "== similar FormData calls ==" sed -n '1,50p' src/api/cv/upload.ts | cat -n || true sed -n '58,65p' src/api/cv/match.ts | cat -n || true sed -n '20,32p' src/api/user/avatar.ts | cat -n || true sed -n '56,66p' src/api/business-company.ts | cat -n || true
Repository: SkillBridgeExe/skillbridge-fe-official
Length of output: 9984
🌐 Web query:
Axios 1.x browser FormData Content-Type headers Content-Type multipart/form-data boundary headers.setContentType undefined
💡 Result:
When using FormData with Axios in browser environments, you should not manually set the Content-Type header [1][2][3]. If you set the Content-Type header manually to multipart/form-data, you often prevent the browser from automatically appending the required multipart boundary (e.g.,; boundary=----WebKitFormBoundary...), which causes the request to be rejected by the server because it cannot parse the body [4][5]. Axios is designed to handle this automatically: 1. Automatic Detection: When you pass a FormData instance as the request data, Axios detects it and automatically removes any manually set Content-Type header to allow the browser's native runtime to set the header correctly, including the unique boundary string [1][5]. 2. Best Practice: Leave the Content-Type header unset in your request config when sending FormData [1]. Axios will ensure the correct multipart headers are applied [6]. 3. Shortcut Methods: Axios provides postForm, putForm, and patchForm methods which are configured to handle multipart/form-data requests automatically [7][2][8]. If you are experiencing issues where setting Content-Type: multipart/form-data results in errors, it is because the boundary is missing or malformed [4]. Removing the header from your configuration allows the browser to perform its native serialization correctly [1][5].
Citations:
🌐 Web query:
Axios 1.6.0 source browser helper shouldRemoveContentHeaders typeOf config headers Content-Type FormData
💡 Result:
In Axios, the handling of the Content-Type header when using FormData is designed to prevent conflicts between user-defined headers and those required by the environment (such as browsers or React Native) to properly include the multipart boundary [1][2]. Historically, Axios has maintained logic—often discussed in issues regarding automatic header removal—where it may attempt to strip or manage the Content-Type header when it detects a FormData object [3][4]. The rationale is that browsers and certain runtimes must calculate the multipart boundary dynamically; manually setting the header can prevent this calculation and result in malformed requests [1][2]. In Axios v1.6.0 and later versions, this behavior is handled through internal logic that inspects the request environment. Specifically, when the runtime is identified as a standard browser or web worker, Axios ensures that the browser is permitted to set the header itself, or it manages the multipart content type internally [5]. For developers who encounter issues where they need to force a specific header: 1. Standard Behavior: Do not manually set the Content-Type header when using FormData in browser, web worker, or React Native environments [1][2]. The runtime will append the necessary multipart boundary automatically [1][2]. 2. Node.js Considerations: In Node.js, Axios supports a formDataHeaderPolicy configuration option [1][6]. The default is 'legacy', which copies all headers returned by a FormData object's getHeaders() method [1][6]. If you are working with untrusted or custom FormData objects and want to restrict which headers are copied, you can set formDataHeaderPolicy: 'content-only' in your request config, which restricts copied headers to only Content-Type and Content-Length [1][6]. 3. Manual Overrides: If you find that Axios is removing a header you explicitly require, it is often due to internal security or compatibility policies intended to prevent duplicate headers or incorrect multipart boundaries [3][4][7]. Current versions of Axios prioritize the integrity of the multipart stream, and manual interference is generally discouraged as it may break the request structure [1][2]. If you are investigating the source code, look for logic involving utils.isFormData(requestData) and environment-specific checks (e.g., platform.isStandardBrowserEnv) which dictate whether the Content-Type header is deleted or explicitly set by the library [5].
Citations:
🌐 Web query:
github axios v1.9.0 source lib helper shouldRemoveContentHeaders delete headers Content-TypeFormData
💡 Result:
In Axios v1.9.0, the removal of the Content-Type header when using FormData is handled within the library's adapter logic, specifically to support automatic boundary generation by browsers. When sending a request with FormData, Axios checks the environment to determine how to manage the Content-Type header: 1. Browser Environments: In standard browser environments (including web workers), Axios explicitly sets the Content-Type header to false [1][2]. This effectively instructs the browser to automatically set the Content-Type header along with the necessary multipart boundary, which is required for the request to be processed correctly [3][4][1]. 2. Non-Browser Environments: In environments such as React Native or other non-browser frameworks, Axios logic has been refined (e.g., via issue #6056 and related fixes included in v1.9.0 [5]) to ensure that the header is not incorrectly removed or malformed [1][2]. If you encounter issues where the header is removed when it should be present, you can manually override this behavior by explicitly setting the Content-Type header in your request configuration: axios.post(url, formData, { headers: { 'Content-Type': 'multipart/form-data' } }); Alternatively, if you need to prevent Axios from overriding your custom headers, you can set the header to false [3][4]. The specific logic for this removal is located in the adapter implementations (e.g., lib/adapters/xhr.js), rather than a standalone helper function named shouldRemoveContentHeaders [1][2].
Citations:
🌐 Web query:
GitHub Axios v1.16.0 lib helpers resolveConfig or mergeData headersContent false FormData
💡 Result:
In Axios v1.16.0, resolveConfig is an internal helper responsible for resolving and hardening configuration objects [1][2][3]. A primary focus of this release was security, specifically prototype pollution hardening, which involved updating resolveConfig to ensure it reads only own properties and utilizes null-prototype objects [2][3]. Regarding the specific components you mentioned: - resolveConfig: It was updated in v1.16.0 to be a named function export (rather than an arrow default export) to improve bundler and Babel interop [4][3]. It also enforces strict property access to ignore inherited values, preventing prototype pollution [3][5]. - mergeData: While Axios uses a mergeConfig function to combine request configurations [6][7], the term mergeData is often associated with the internal logic for handling the data property. In v1.16.0 and related updates, handling of request data merging was refined, including ensuring enumerable symbol keys are preserved [4][3]. - FormData and headers: A significant change in v1.16.0 (and subsequent minor patches/PRs) involved how FormData headers are managed [4][8]. For instance, React Native FormData now has its default Content-Type cleared so that multipart boundaries can be generated correctly instead of defaulting to application/x-www-form-urlencoded [4][8]. Additionally, security hardening was applied to prevent injected headers via polluted FormData.getHeaders [3]. The configuration options mentioned, such as formDataHeaderPolicy, were also introduced around this time to control how FormData headers are copied, offering modes like legacy (default) and content-only [2]. Sources: [1][2][4][3][5][8]
Citations:
Không đặt Content-Type thủ công với FormData.
multipart/form-data thiếu boundary, nên backend có thể không đọc được file và các trường form trong request. Axios v1 cũng quản lý header này khi payload là FormData; bỏ header này để browser hoặc axios tự tạo header hợp lệ.
httpClient.post(API_ROUTES.DIAGNOSIS.CV_ANALYSIS, formData, {
timeout: CV_AI_TIMEOUT_MS,
- headers: { "Content-Type": "multipart/form-data" },
}),
‼️ 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.
| httpClient.post(API_ROUTES.DIAGNOSIS.CV_ANALYSIS, formData, { | |
| timeout: CV_AI_TIMEOUT_MS, | |
| headers: { "Content-Type": "multipart/form-data" }, | |
| }), | |
| httpClient.post(API_ROUTES.DIAGNOSIS.CV_ANALYSIS, formData, { | |
| timeout: CV_AI_TIMEOUT_MS, | |
| }), |
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/api/cv/analysis.ts` around lines 32 - 35, Remove the manually specified
“Content-Type” header from the httpClient.post call for
API_ROUTES.DIAGNOSIS.CV_ANALYSIS, leaving Axios or the browser to generate the
multipart/form-data header and boundary for the FormData payload. Keep the
existing timeout and request behavior unchanged.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| setUploadedOnlyCvId(null); | ||
| setReviewData(null); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Xóa trạng thái uploadedOnlyCvId cho mọi CV mới.
Line 328 chỉ xóa trạng thái này trước analyzeWithJd. Sau kết quả UPLOADED_ONLY, người dùng có thể đổi CV hoặc chạy analyzeCvOnly rồi gặp lỗi. Khi đó cảnh báo và CTA mua credit của CV cũ vẫn hiển thị.
Xóa trạng thái khi chọn hoặc xóa CV, và trước cả analyzeCvOnly lẫn analyzeWithJd.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| useEffect(() => { | ||
| const handler = setTimeout(() => { | ||
| if (isExplorerOpen) { | ||
| setQueryState(p => { | ||
| if (p.q === searchInput) return p; | ||
| setAccumulatedRecs([]); | ||
| return { ...p, q: searchInput || undefined, offset: 0 }; | ||
| }); | ||
| } | ||
| }, 400); | ||
| return () => clearTimeout(handler); | ||
| }, [searchInput, isExplorerOpen]); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Giữ callback của setQueryState thuần.
Dòng 538 gọi setAccumulatedRecs bên trong callback của setQueryState. React có thể gọi lại callback này. Việc xóa danh sách có thể chạy lặp và callback không còn thuần.
Tính giá trị q trước. Nếu truy vấn thay đổi, hãy gọi setAccumulatedRecs([]) bên ngoài callback.
useEffect(() => {
const handler = setTimeout(() => {
- if (isExplorerOpen) {
- setQueryState(p => {
- if (p.q === searchInput) return p;
- setAccumulatedRecs([]);
- return { ...p, q: searchInput || undefined, offset: 0 };
- });
- }
+ const q = searchInput || undefined;
+ if (!isExplorerOpen || queryState.q === q) return;
+ setAccumulatedRecs([]);
+ setQueryState((prev) => ({ ...prev, q, offset: 0 }));
}, 400);
return () => clearTimeout(handler);
-}, [searchInput, isExplorerOpen]);
+}, [searchInput, isExplorerOpen, queryState.q]);
‼️ 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.
| useEffect(() => { | |
| const handler = setTimeout(() => { | |
| if (isExplorerOpen) { | |
| setQueryState(p => { | |
| if (p.q === searchInput) return p; | |
| setAccumulatedRecs([]); | |
| return { ...p, q: searchInput || undefined, offset: 0 }; | |
| }); | |
| } | |
| }, 400); | |
| return () => clearTimeout(handler); | |
| }, [searchInput, isExplorerOpen]); | |
| useEffect(() => { | |
| const handler = setTimeout(() => { | |
| const q = searchInput || undefined; | |
| if (!isExplorerOpen || queryState.q === q) return; | |
| setAccumulatedRecs([]); | |
| setQueryState((prev) => ({ ...prev, q, offset: 0 })); | |
| }, 400); | |
| return () => clearTimeout(handler); | |
| }, [searchInput, isExplorerOpen, queryState.q]); |
[error] 536-536: This state updater performs the nested state update "setAccumulatedRecs()". React may run updater functions more than once, so side effects here can repeat or observe inconsistent external state.
Keep state updater callbacks pure and return only the next state. Move notifications, storage, timers, ref writes, and other external work into the event or effect that queues the update.
(no-impure-state-updater)
[error] 538-538: This side-effecting call runs inside a state updater, which React may invoke more than once. Move it outside the setter after computing the next state.
React may replay a state updater, so callbacks, analytics, and persistence inside it can run more than once. Compute state purely, then perform the side effect outside the setter.
(no-side-effect-in-state-updater-function)
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/diagnosis/JobRecommendations.tsx` around lines 533 - 544, Keep
the setQueryState updater callback in the useEffect pure by computing the next
query value before calling it. When the query changes, invoke
setAccumulatedRecs([]) outside the updater callback, while preserving the
existing query, offset reset, debounce, and explorer-open behavior.
Source: Linters/SAST tools
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| <SelectField | ||
| label={t("billing.admin.table.category")} | ||
| value={form.category} | ||
| onChange={(category) => | ||
| setForm((prev) => ({ ...prev, category })) | ||
| } | ||
| disabled={Boolean(selectedPlan)} | ||
| options={["SUBSCRIPTION", "MENTOR_PACKAGE"]} | ||
| /> |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Cho phép tạo CREDIT_PACKAGE.
Khi tạo plan mới, danh sách ở Line 415-423 chỉ có SUBSCRIPTION và MENTOR_PACKAGE. Quản trị viên không thể chọn CREDIT_PACKAGE. toCreatePayload cũng loại trừ category này và không gửi creditUnits.
Thêm CREDIT_PACKAGE vào luồng tạo. Gửi creditUnits khi category là CREDIT_PACKAGE. Giữ quota ngoài payload của credit package.
As per path instructions, prioritise real bugs, type-safety holes, React hooks misuse, state/store correctness, accessibility, and security.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/pages/admin/AdminBillingPlans.tsx` around lines 415 - 423, Update the
new-plan flow around the category SelectField and toCreatePayload to include
CREDIT_PACKAGE as a selectable category. When category is CREDIT_PACKAGE,
include creditUnits in the creation payload; keep quota excluded for credit
packages. Preserve the existing payload behavior for SUBSCRIPTION and
MENTOR_PACKAGE.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.