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 v2 dark theme #377

Merged
merged 2 commits into from
Apr 13, 2024
Merged

Fix v2 dark theme #377

merged 2 commits into from
Apr 13, 2024

Conversation

jamiees2
Copy link
Contributor

@jamiees2 jamiees2 commented Apr 3, 2024

e9d6955 introduced a bug where if the app is using a Material V2 dark theme, the time picker will access a color property which isn't defined, resulting in a hard crash with a "Cannot read property 'level3' of undefined".

This is due to the previous logic gating on theme.isV3 before accessing the property, while the current logic does not gate on this.

This PR changes the logic to be similar to the change to Day.tsx, which does check if the theme is V3 before accessing potentially undefined properties.

We have deployed this change to our app, and it has fixed the crashes our users were seeing.

@iM-GeeKy
Copy link
Collaborator

iM-GeeKy commented Apr 3, 2024

@jamiees2 This looks okay once the linting error is resolved. I'll let @RichardLindhout be responsible for merging it after he takes a look.

const v2Color = theme.dark
? overlay(10, theme.colors.surface)
: theme.colors.surface
let color
Copy link
Contributor

Choose a reason for hiding this comment

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

let color = theme.isV3 
            ? (theme.dark ? theme.colors.elevation.level3 : theme.colors.surface)
            : (theme.dark ? overlay(10, theme.colors.surface) : theme.colors.surface)

A suggestion here.
Maybe like this is cleaner and avoid repeat color

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While I agree, this seemed like the style of code that e9d6955 was attempting to remove from the codebase.

Based on that commit, I just pattern matched some of the other rewrites that were done in that same commit, while fixing the issue.

@iM-GeeKy
Copy link
Collaborator

@jamiees2 Can you resolve the merge conflict? Then I'll go ahead and merge it.

@jamiees2
Copy link
Contributor Author

Done :)

@iM-GeeKy iM-GeeKy merged commit 77f445c into web-ridge:master Apr 13, 2024
5 checks passed
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.

3 participants