Unplanned
Last Updated: 20 Mar 2023 14:21 by David
Kian
Created on: 12 Mar 2020 09:37
Category: UI for Blazor
Type: Feature Request
15
QueryableExtensions.ToDataSourceResultAsync method should support CancellationToken

We use QueryableExtensions.ToDataSourceResultmethod to load some data in our component. And at some moment we need to cancel data loading. But ToDataSourceResult method doesn’t support CancellationToken. So we are forced to use a workaround and just ignore the task's result. But task is still executing and causing the performance hit

It would be great if you implemented support for this feature!

8 comments
David
Posted on: 20 Mar 2023 14:21

I agree with the others that this is pretty important.
Coming from the MVC version of this function, I had alot of confusion as to why a CancellationToken can't be passed.

Seeing this brought up 3 years ago and is currently marked as "Unplanned" is disheartening...

If anyone else has a work around, I would love to see what you came up with.

Clark
Posted on: 27 Jun 2022 18:11

Wanted to chime in that we need this too. Since adopting the use of the DataSource extensions, we've discovered that our CancellationToken is passed all the way down only to go unused here, where it's needed most. Obviously, this should pass the token down to the underlying operation so a long-running database query could be canceled, for example. Currently it looks like .ToDataSourceResultAsync() is just a task wrapper for the synchronous .ToDataSourceResult() method.

I'd really like to avoid creating a homegrown library similar to this one, since this already does so much and is a huge help!

Voted and followed.

ADMIN
Marin Bratanov
Posted on: 16 Dec 2021 21:08

Hello Diego,

The best way to know when something happens is to click the Follow button - this will subscribe you for emails with status updates, and we will update the page when something happens (say, a release number is known).

Regards,
Marin Bratanov
Progress Telerik

Learn about the important changes coming in UI for Blazor 3.0 in January 2022!
Diego
Posted on: 15 Dec 2021 20:19
Any news here? I actually need to cancel queries during grid pagination (from Kendo Angular Grid component)
Luca
Posted on: 28 Jun 2021 06:41
I think it is a crucial feature, we have few kendo grid (angular) with virtual scroll enabled and we need for sure to cancel old page requests during user interaction to increase performance and also decrease cost (if you think on a cloud solution it is really important)
ADMIN
Marin Bratanov
Posted on: 03 Sep 2020 12:06

Hi Korstiaan,

I suggest you consider the following options:

  • use the FilterMenu mode where filtering happens on a button click rather than on every keystroke
  • or, use the filter template to trigger filtering when you want (more rarely - either on a button click or in the OnChange event of an input)

 

Regards,
Marin Bratanov
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

Korstiaan
Posted on: 03 Sep 2020 11:23
We're currently in need of this too.
We're sending the serialized DataSourceRequest to the server, so we can use the ToDataSourceResultAsync method, which works awesomely, but since our grids call the OnRead event for every typed letter in the filter boxes, we need to cancel the server queries ourselves. It's a bit stupid to cancel a request, but still having an SQL query run to completion for no reason (double so since it does a query for the total amount of records too).
ADMIN
Marin Bratanov
Posted on: 13 Mar 2020 08:24

Hello Kian,

I altered the title a little bit because the .ToDataSourceResultAsync() method could get such support, .ToDataSourceResult() is synchronous.

You can also click the Follow button to get email notifications for status update on this feature.

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor