Skip to content

Override Taiwan country label#70

Open
keshav-005 wants to merge 2 commits into
Open-Dev-Society:mainfrom
keshav-005:fix-34-country-label
Open

Override Taiwan country label#70
keshav-005 wants to merge 2 commits into
Open-Dev-Society:mainfrom
keshav-005:fix-34-country-label

Conversation

@keshav-005
Copy link
Copy Markdown
Contributor

@keshav-005 keshav-005 commented Apr 22, 2026

Summary

  • override the signup country label for TW to display Taiwan
  • keep the existing country list library and only adjust the rendered label for that entry

Test plan

  • npx eslint components/forms/CountrySelectField.tsx

Fixes #34

Summary by CodeRabbit

  • Bug Fixes
    • Fixed country label display so overridden names (e.g., Taiwan) show correctly and consistently in both the dropdown and the selected value.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 22, 2026

@keshav-005 is attempting to deploy a commit to the ravixalgorithm's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0cb2fbb0-9c45-4c4c-ae68-cbaac2ec7d95

📥 Commits

Reviewing files that changed from the base of the PR and between b517689 and 2a339c6.

📒 Files selected for processing (1)
  • components/forms/CountrySelectField.tsx

📝 Walkthrough

Walkthrough

Reworked the country select to apply a label-overrides map (e.g., TWTaiwan) by building a precomputed COUNTRY_OPTIONS array from countryList().getData() and using it for both the dropdown and selected label lookup; removed the previous local countries variable.

Changes

Cohort / File(s) Summary
Label override & options generation
components/forms/CountrySelectField.tsx
Added COUNTRY_LABEL_OVERRIDES and COUNTRY_OPTIONS derived from countryList().getData(); apply overridden labels when building option labels and when resolving the selected-country label; removed local countries variable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped in with a careful tweak,
A label fixed for the island meek.
Now Taiwan’s name stands calm and clear,
A tiny flourish, full of cheer. 🎋

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Override Taiwan country label' directly and clearly describes the main change of overriding the Taiwan country label in the CountrySelectField component.
Linked Issues check ✅ Passed The PR implements the objective from issue #34 by introducing a country label override for Taiwan (TW → Taiwan) to correct its representation and ensure it is not shown as a province of China.
Out of Scope Changes check ✅ Passed All changes in the PR are scoped to the CountrySelectField component and directly address the Taiwan label override requirement; no unrelated or out-of-scope modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
components/forms/CountrySelectField.tsx (1)

47-50: Optional: memoize the countries list.

countries is recomputed on every render of CountrySelect. Since the data is static, wrapping it in useMemo (or hoisting it to module scope) would avoid repeated allocation and mapping on each keystroke/open toggle.

♻️ Proposed refactor
-    const [open, setOpen] = useState(false);
-
-    // Get country options with flags
-    const countries = countryList().getData().map((country) => ({
-        ...country,
-        label: COUNTRY_LABEL_OVERRIDES[country.value] ?? country.label,
-    }));
+    const [open, setOpen] = useState(false);
+
+    // Get country options with flags
+    const countries = useMemo(
+        () =>
+            countryList()
+                .getData()
+                .map((country) => ({
+                    ...country,
+                    label: COUNTRY_LABEL_OVERRIDES[country.value] ?? country.label,
+                })),
+        []
+    );

And add useMemo to the existing react import.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/forms/CountrySelectField.tsx` around lines 47 - 50, The countries
array in the CountrySelect component is recreated on every render; memoize it by
wrapping the mapping of countryList().getData() (and the label override using
COUNTRY_LABEL_OVERRIDES) in a useMemo inside CountrySelect, or alternatively
hoist the computed list to module scope if it truly is static; also add useMemo
to the react import so the component reuses the same array across renders and
avoids repeated allocations on keystrokes/toggles.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@components/forms/CountrySelectField.tsx`:
- Around line 47-50: The countries array in the CountrySelect component is
recreated on every render; memoize it by wrapping the mapping of
countryList().getData() (and the label override using COUNTRY_LABEL_OVERRIDES)
in a useMemo inside CountrySelect, or alternatively hoist the computed list to
module scope if it truly is static; also add useMemo to the react import so the
component reuses the same array across renders and avoids repeated allocations
on keystrokes/toggles.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d429508d-9867-48e7-82a3-015908c3ed7f

📥 Commits

Reviewing files that changed from the base of the PR and between fe59884 and b517689.

📒 Files selected for processing (1)
  • components/forms/CountrySelectField.tsx

@keshav-005
Copy link
Copy Markdown
Contributor Author

Updated with a small follow-up: the static country list is now hoisted so the label override data isn’t rebuilt on each render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Taiwan is “not” a province of China

1 participant