Closed jamesgol closed 6 years ago
I was never able to reproduce this in #4418 but it was also reported there.
I've attempted to reproduce this a few different times without any luck so let me know if you can think of what might be different.
The root of the problem is we don't need to invoke the plupload uploader so it doesn't have that method. plupload places a shim over the upload button and takes control on its own so, when working properly, the button click event never fires and the event-handler that calls invoke doesn't get called.
So a simple fix should be to only try to run the function if this.uploader is valid
It sounds like it would treat the symptom but I'd really like to know why it's happening if possible.
Having a comment there is not an excuse to ignore checking the validity of calling invoke()
but I would like to know if it's an indicator that something else isn't working right before forever suppressing our surprise via error.
@jamesgol: can you get me a package export to test with? Sometimes these edge cases happen if there is only one field setup a certain way, sometimes it won't happen if there's just one field, sometimes it depends on the Pod type and options.
I could do an export but it'd be quicker just to create a new pod and add a single plupload field with defaults
I could really use some help trying to reproduce this if anyone else has any bandwidth, @jimtrue, @nicdford, @JoryHogeveen, @sc0ttkclark
I still get a clean console in both Chromium and FF, Jim can reproduce
I'm able to reproduce the issue, though it reads slightly different.
Uncaught TypeError: this.uploader.invoke is not a function
at n.onChildviewAddFileClick (file-upload.js:80)
at n._childViewEventHandler (view.js:203)
at _ (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,suggest,wp-ajax-response,jquery-color,wp-lists,jquery-ui-core,jquery-ui-widget,j&load[]=query-ui-mouse,jquery-ui-sortable,postbox,jquery-ui-position,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box&load[]=,underscore,word-count,post,editor-expand,svg-painter,wp-auth-check,shortcode,backbone,wp-util,wp-backbone,media-models,plupload&load[]=,wp-plupload,mediaelement,wp-mediaelement,media-views,media-editor,media-audiovideo,mce-view,imgareaselect,image-edit&ver=4.8.3:346)
at m (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,suggest,wp-ajax-response,jquery-color,wp-lists,jquery-ui-core,jquery-ui-widget,j&load[]=query-ui-mouse,jquery-ui-sortable,postbox,jquery-ui-position,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box&load[]=,underscore,word-count,post,editor-expand,svg-painter,wp-auth-check,shortcode,backbone,wp-util,wp-backbone,media-models,plupload&load[]=,wp-plupload,mediaelement,wp-mediaelement,media-views,media-editor,media-audiovideo,mce-view,imgareaselect,image-edit&ver=4.8.3:346)
at f (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,suggest,wp-ajax-response,jquery-color,wp-lists,jquery-ui-core,jquery-ui-widget,j&load[]=query-ui-mouse,jquery-ui-sortable,postbox,jquery-ui-position,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box&load[]=,underscore,word-count,post,editor-expand,svg-painter,wp-auth-check,shortcode,backbone,wp-util,wp-backbone,media-models,plupload&load[]=,wp-plupload,mediaelement,wp-mediaelement,media-views,media-editor,media-audiovideo,mce-view,imgareaselect,image-edit&ver=4.8.3:346)
at n.u.trigger (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,suggest,wp-ajax-response,jquery-color,wp-lists,jquery-ui-core,jquery-ui-widget,j&load[]=query-ui-mouse,jquery-ui-sortable,postbox,jquery-ui-position,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box&load[]=,underscore,word-count,post,editor-expand,svg-painter,wp-auth-check,shortcode,backbone,wp-util,wp-backbone,media-models,plupload&load[]=,wp-plupload,mediaelement,wp-mediaelement,media-views,media-editor,media-audiovideo,mce-view,imgareaselect,image-edit&ver=4.8.3:346)
at n.triggerMethod$1 (trigger-method.js:40)
at n.triggerMethod (view.js:181)
at n.<anonymous> (triggers.js:35)
at HTMLDivElement.dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.8.3:3)
The this.uploader.invoke is not a function
part is the main thing, so that's 3/4... everyone but me.
So a simple fix should be to only try to run the function if this.uploader is valid
We've narrowed it down to browser environment and that's not a minefield to continue through. This solution it is.
With 'Upload Only (Plupload)' on a single or multi file field, clicking the 'Add File' button on a backend post generates a JavaScript error in the console
Upload appears to work fine though.