Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DateTimeSettingsTimeZoneSelect #7688

Merged
merged 1 commit into from
Oct 15, 2024
Merged

Conversation

ijreilly
Copy link
Collaborator

Fixing sentry Cannot read properties of undefined (reading 'label')

@@ -25,7 +26,9 @@ export const DateTimeSettingsTimeZoneSelect = ({
value={value}
options={[
{
label: `System settings - ${systemTimeZoneOption.label}`,
label: isDefined(systemTimeZoneOption)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lucasbordeau do you have knowledge on this ? I don't know when systemTimeZoneOption can be undefined

Copy link
Contributor

Choose a reason for hiding this comment

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

The typing of findAvailableTimeZoneOption should certainly be SelectOption<string> | undefined since it indexes a dictionary and the key could be nonexistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should open an issue, as :

  • The typing should be fixed
  • We should investigate why it is trying to index a non existent key

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This pull request addresses a Sentry error in the DateTimeSettingsTimeZoneSelect component by adding a safety check for undefined values.

  • Added isDefined import and usage in packages/twenty-front/src/pages/settings/profile/appearance/components/DateTimeSettingsTimeZoneSelect.tsx to prevent "Cannot read properties of undefined (reading 'label')" error
  • Implemented conditional rendering for the system time zone label, improving component robustness
  • The fix maintains the component's core functionality while enhancing its error handling capabilities

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@ijreilly ijreilly merged commit 17ec538 into main Oct 15, 2024
11 of 13 checks passed
@ijreilly ijreilly deleted the fix-sentry-systemTimeZoneOption branch October 15, 2024 08:57
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