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

JavaScript error while generating webp images from the settings page #496

Open
Screenfeed opened this issue May 8, 2020 · 0 comments
Open

Comments

@Screenfeed
Copy link
Contributor

TypeError: item is undefined
https://example.com/wp-content/plugins/imagify/assets/js/options.js line 778

if ( ! this.queue.length && ! this.processingQueue.length ) {
return;
}
// Optimize the files.
$.each( this.queue, function ( i, item ) {
if ( _this.processingQueue.length >= imagifyOptions.bulk.bufferSize ) {
return false;
}
$.each( item.mediaIDs, function () {
_this.processMedia( {
context: item.context,
mediaID: item.mediaIDs.shift(),
optimizeURL: item.optimizeURL
} );

The loop finds a second item in this.queue while there is actually only one. I couldn't find the reason of this error but this simple test prevents the issue:

// Optimize the files.
$.each( this.queue, function ( i, item ) {
	if ( ! item ) {
		return true;
	}
	if ( _this.processingQueue.length >= imagifyOptions.bulk.bufferSize ) {
		return false;
	}

Browser: Firefox Developer Edition 77.0b2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants