zadjii-msft / PowerToys

Windows system utilities to maximize productivity
MIT License
3 stars 2 forks source link

Don't make list pages a list of sections. Items should just have a section property #99

Open zadjii-msft opened 1 month ago

zadjii-msft commented 1 month ago

This is me reading between the lines from Teams chats I missed.

As currently written (10/21), IListPage.GetItems returns a list of ISections, each Section filled with items.

That, as it turns out, is really dumb and hard to consume. So let's just not.

It's easier to stick another property on IListItem that represents the grouping. Then we can very easily map that property to groups.

/cc @michael-hawker

zadjii-msft commented 1 month ago

Kristen and I were also discussion if extensions just return items and items have a group string or something and the UI does the grouping vs. extensions having to structure their data. Then it could just be public async Task<IAsyncEnumberable<IListItem>> Getitems() or something (maybe we need an IAsyncOperation for WinRT), but then the extension author could yield return here maybe as results come in and get transposed to the item from the other data model?

(And IListItem would have a Group string or identifier)

Doc ref: C# - Iterating with Async Enumerables in C# 8 | Microsoft Learn

zadjii-msft commented 1 month ago

Other docs: