Skip to content

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

@ThomasMaij

Description

@ThomasMaij

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",

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions