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

Add null check to observeField() function #950

Merged
merged 1 commit into from
May 6, 2021

Conversation

rparada
Copy link
Contributor

@rparada rparada commented May 6, 2021

Some user interface components switch between view only and editing mode. When in view mode the form fields are left out of the page. This results in javascript errors when having AjaxObserveField when the observe element does not exist. Rather than putting a WOConditional around every AjaxObserveField it seems better to simply add a null check in the observeField() function used by AjaxObserveField. This simplifies things.

The fix adds a null check at the top and logs a message to the javascript console if the element does not exist rather than resulting in javascript errors which looks pretty bad.

@darkv darkv merged commit a27b5b3 into wocommunity:master May 6, 2021
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