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 browser warning error when clicking the reset button #505

Merged
merged 1 commit into from
Jan 15, 2024
Merged

Fix browser warning error when clicking the reset button #505

merged 1 commit into from
Jan 15, 2024

Conversation

t-hamano
Copy link
Contributor

This PR fixes warning error when clicking the reset button.

image

resetAxes() is called to reset these two controls for variable fonts in the font file preview settings.

resetAxes

However, on the "Manage Theme Fonts" and "Add Google Fonts" pages, these two components related to variable fonts are not rendered. In other words, the <DemoTextInput> component is not passed props(axes, setAxes, resetAxes ) regarding variable fonts.

As a result, resetAxes() is undefined and causes an error.

To avoid this error I used optional chaining (?.).

Copy link
Member

@mikachan mikachan left a comment

Choose a reason for hiding this comment

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

Very nice, thanks @t-hamano!

@mikachan mikachan merged commit 993571e into WordPress:trunk Jan 15, 2024
1 check passed
@t-hamano t-hamano deleted the fix-reset-console-error branch January 15, 2024 10:05
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