Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/pages/household/VariableSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SearchOptions from "../../controls/SearchOptions";

export default function VariableSearch(props) {
const { metadata, callback } = props;
const countryId = window.location.pathname.split("/")[1];
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue, minor: If possible at this point in the code, use the useCountryId hook, which you'll find used in many other components, or pull the country ID from the metadata that you have passed down (I believe it's metadata.countryId).

const [searchParams, setSearchParams] = useSearchParams();
const showComputed = searchParams.get("showComputedVariables") === "true";
const options = Object.values(metadata.variables)
Expand All @@ -14,8 +15,12 @@ export default function VariableSearch(props) {
label: variable.label,
}))
.filter((option) => !!option.label && !!option.value);

options.push({
value: "input.household.countyName",
value:
countryId === "us"
? "input.geography.countyName"
: "input.household.countyName",
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue, blocking: We don't want to push input.household.countyName outside of the US context, we just don't want to modify it at all if it's present for some reason

If we add it the way you do here, it'll show up on our UK and Canadian sites, where it's actually not an option.

label: "County name",
});
return (
Expand Down
Loading