-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Conversation
@@ -25,7 +26,9 @@ export const DateTimeSettingsTimeZoneSelect = ({ | |||
value={value} | |||
options={[ | |||
{ | |||
label: `System settings - ${systemTimeZoneOption.label}`, | |||
label: isDefined(systemTimeZoneOption) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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 inpackages/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
Fixing sentry Cannot read properties of undefined (reading 'label')