Skip to content

Conversation

@jmgasper
Copy link
Collaborator

No description provided.

@jmgasper jmgasper merged commit e6e4ae4 into develop Jan 23, 2026
4 checks passed
}))
return [ANY_OPTION, ...zones]
const { timeZoneOptions, timeZoneOptionByZone } = useMemo(() => {
const optionByLabel = new Map()

Choose a reason for hiding this comment

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

[⚠️ design]
The use of Map for optionByLabel is appropriate for ensuring unique labels, but the conversion of labels to lowercase (normalizedLabel) might lead to unexpected behavior if labels are case-sensitive or if different labels are intended to be distinct. Consider whether case-insensitivity is necessary and document this decision.

const selected = []
const seen = new Set()
timeZones.forEach((zone) => {
const option = timeZoneOptionByZone.get(zone)

Choose a reason for hiding this comment

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

[❗❗ correctness]
The selectedTimeZones logic assumes that timeZoneOptionByZone will always have a mapping for each zone. If formatTimeZoneLabel returns a falsy value or if a zone is not found in timeZoneOptionByZone, it might lead to unexpected results. Ensure that all possible zone values are covered or handle the case where a zone is not found.

timezones.push(ANY_OPTION.value)
return
}
if (!Array.isArray(option.zones) || option.zones.length === 0) {

Choose a reason for hiding this comment

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

[❗❗ correctness]
The check !Array.isArray(option.zones) || option.zones.length === 0 is used to skip options without zones. Ensure that all valid options have non-empty zones arrays, or handle cases where zones might be empty to avoid potential issues.

const uniqueLabels = []
const seenLabels = new Set()
labels.forEach((label) => {
const normalized = label.toLowerCase()

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider using label.trim().toLowerCase() to normalize labels, as this will handle cases where labels have leading or trailing whitespace differences.

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.

2 participants