telerik / kendo-ui-core

An HTML5, jQuery-based widget library for building modern web apps.
http://www.telerik.com/kendo-ui
Other
2.54k stars 1.91k forks source link

JS error thrown by Upload on deleting a just uploaded file #7287

Closed ThomasMaij closed 1 year ago

ThomasMaij commented 1 year ago

Bug report

Upload control when deleting a just uploaded file it writes errors to the log:

Uncaught TypeError: Cannot read properties of undefined (reading 'value')
    at HTMLDivElement.<anonymous> (kendo.upload.js:1312:1)
    at opt.complete (jquery.js:7822:1)
    at fire (jquery.js:3536:1)
    at Object.fireWith [as resolveWith] (jquery.js:3666:1)
    at tick (jquery.js:7665:1)
    at jQuery.fx.tick (jquery.js:7992:1)
    at schedule (jquery.js:7368:1)

perhaps the progress bar was still being updated asynchronously, but it is already gone from the html.

Reproduction of the problem

  1. Go to https://demos.telerik.com/kendo-ui/upload/index
  2. Select a file and click Upload button to upload it
  3. Delete the just uploaded file, sometimes you will be rewarded
$(PROGRESSBAR_SELECTOR, fileEntry)
                .delay(PROGRESSHIDEDELAY)
                .fadeOut(PROGRESSHIDEDURATION, function() {
                    $(this).data("kendoProgressBar").value(0);
                });

Fix might be as easy as adding a undefined check

Current behavior

it logs errors to the console:

Uncaught TypeError: Cannot read properties of undefined (reading 'value')
    at HTMLDivElement.<anonymous> (kendo.upload.js:1312:1)
    at opt.complete (jquery.js:7822:1)
    at fire (jquery.js:3536:1)
    at Object.fireWith [as resolveWith] (jquery.js:3666:1)
    at tick (jquery.js:7665:1)
    at jQuery.fx.tick (jquery.js:7992:1)
    at schedule (jquery.js:7368:1)

Expected/desired behavior

No errors

Environment

"@progress/kendo-ui": "2023.1.314",
"@progress/kendo-theme-bootstrap": "6.2.0",
 "jquery": "3.6.4",
ThomasMaij commented 1 year ago

Any updates?

Dimitar-Goshev commented 1 year ago

@ThomasMaij Thank you for your report. The issue is reproducible on my side as well. Track it for updates on its progress.

pepinho24 commented 1 year ago

Reported also in ticket 1621779

diegobarriosdev commented 1 year ago

I got the same issue: TypeError: Cannot read properties of undefined (reading 'value')\n at HTMLDivElement.<anonymous> (/kendo-ui/scripts/kendo.all.min.js:9:1878044)\n at r.complete (/node_modules/jquery/dist/jquery.min.js:2:61029)\n at c (/node_modules/jquery/dist/jquery.min.js:2:25266)\n at Object.fireWith [as resolveWith] (/node_modules/jquery/dist/jquery.min.js:2:26015)\n at u (/node_modules/jquery/dist/jquery.min.js:2:57736)\n at ce.fx.tick (/node_modules/jquery/dist/jquery.min.js:2:62744)\n at dt (/node_modules/jquery/dist/jquery.min.js:2:57060)