uno.extensions icon indicating copy to clipboard operation
uno.extensions copied to clipboard

[Reactive] Change pagination uint to int

Open weitzhandler opened this issue 2 years ago • 2 comments

Intro

MVUX pagination methods use uint methods.

If I understand correctly this is because no negative values are expected to be used. uint is also used in ISupportIncrementalLoading.LoadMoreItems

Request

My requst is to consider changing the uints to ints.

Reasons

  • Standard integer is common use by developers and using uint requires a lot of redundant and tedious casting. Personally I think it's worth the overhead of a param check and throw an exception if arg out of range
  • No support for uint in XAML
  • In some scenarios a negative value could be valid, for example when navigating backwards

weitzhandler avatar May 04 '23 04:05 weitzhandler

This should be discussed and either moved forward or discarded in 5.0 timeframe

nickrandolph avatar Sep 14 '23 04:09 nickrandolph

Personally I think we should keep uint:

  • It's the structure used by more and more dotnet APIs, especially UWP/WinUI and specifically the ISupportIncrementalLoading.LoadMoreItemsAsync(https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.data.isupportincrementalloading.loadmoreitemsasync?view=winrt-22621) (which is the interface supported by the view to trigger the pagination)
  • Negative page indexes are not supported by this API and will not since it would require to have more parameters to determine the initial page index. And considering that pagination using index APIs are just special case of the pagination by cursor and are designed to ease the common case, I think that we will not try to provide such support in those APIs as it's definitely not the "common case".
  • Using int in endpoint is 99% an error from developers, as the API will reject any negative index. uint is the most appropriate structure.
Initializes incremental loading from the view.

dr1rrb avatar Sep 20 '23 07:09 dr1rrb