Declined
Last Updated: 21 Feb 2023 13:32 by ADMIN
Dominik
Created on: 08 Feb 2023 13:29
Category: Kendo UI for Angular
Type: Bug Report
1
Returning false as dialog result returns empty object and result typing

In dialog, if we close it giving `false` as a result i.e.

```

this.dialog.close(false)

```

Actual return is empty object.

Additional thing is result itself in `DialogRef` is force-typed as `DialogResult` despite that actual `dialogRef.close()` allows us to return any value.In such case I'd understand mapping to empty object (probably some truthy-based if which maps to empty object) but then close method should also force-type taken argument. So can we return any value or not?

Ideally it should return `undefined` in case of no result value is provided (also mapped to empty object) and return `false` if we return `false`

3 comments
ADMIN
Yanmario
Posted on: 21 Feb 2023 13:32

Hi Dominik,

My last reply might not have been constructed correctly and I do apologize for that. What I meant is that the following sentence from the close API isn't correct:

`When called with an argument, the result Observable will hold the provided value.`

This means that the return argument cannot be a custom value set by the developer and the instance will be always closed with DialogResult which is the currently clicked action or DialogCloseResult which is an empty object in case the `X` button was clicked.

I hope this explains the exact issue in our documentation and that a value set by the developer won't be returned as a result.

Regards,
Yanmario
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Dominik
Posted on: 15 Feb 2023 12:03

Hey Yanmario

I must admit I don't fully understand. It's not like documentation is unclear - you clearly state close function can take argument in at least three places like:

- https://www.telerik.com/kendo-angular-ui-develop/components/dialogs/api/DialogRef/#toc-close (as you mentioned)

- https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/service/#toc-titlebar-close-prevention

- https://www.telerik.com/kendo-angular-ui-develop/components/dialogs/api/DialogRef/#toc-result

But what bothers me more now - if close is supposed to not take arguments, in case of single component rendering how exactly am I supposed to return some result like in case of confirmation dialog?

 

ADMIN
Yanmario
Posted on: 15 Feb 2023 10:11

Hi Dominik,

Thank you for the provided feedback.

The DialogRef close function is expected to be called with no arguments or object of type DialogResult Observable. I do apologize if something is unclear in our documentation and I will log an improvement thread to the documentation to be more clear on what is expected and used.

As such the behavior is currently correct for our component and the bug report will be declined. However, the documentation improvement is valid as it might mislead users of our component library.

Regards,
Yanmario
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.