[Feature]: Improve ChangeSet emission when a single item moves upwards in index on a Sort

オープン
#1,066 コメント 20 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
csharp
領域
backend

調査の方向性

Start by reading Internal/List.cs and the ChangeAwareList.Move implementation described in the issue, then look for tests covering sort-driven move changes and reset thresholds. Verify the proposed single-item upward move case against the existing change stream behavior. Done means the case emits one Move change rather than many, with tests confirming the bound-list reset threshold is not triggered.

索引モデルが issue の本文から書いたものです。

説明

Describe the functionality desired 🐞

Currently, if a Sort causes a single item to move from a low index to a high index, instead of generating one single Move change for the given item, the Reorder implementation in Internal/List.cs emits move down by 1 events for every item in the list between the old and new index of the 'moved' item.

I understand that moving one item up n spaces, and moving n items down 1 space are equivalent and symmetric operations, but the stream of change events from each item moving can easily trigger reset thresholds (eg on Bind)

It's an uncomfortable gotcha when a 'single' upstream property change explodes into a stream of N events, and then resets all bound view components due to a list refresh just because it moved more than 25 indices.

I understand this is a well known problem in React as well, just in the opposite direction

I know that finding a minimal sequence of moves is O(n^2), but it should be possible to optimize for the 'single item moved up' case by adding some logic in ChangeAwareList.Move which:

  • Detects 'move down by 1' events (destination == original - 1)
  • Converts them to 'move up by 1' events on the previous item
  • Checks the last entry in _changes. If it is a move up by n event, with last.destination == destination then instead of emitting a new event, convert the last event to 'move up by n+1'
The steps the functionality will provide

Performance optimization and no rest threshold triggered when a single item moves up in index due to a sort.

Considerations

I don't have a checkout of the code available to test my theory. A workaround exists to just set resetThreshold: int.MaxValue but it's a bit uncomfortable

主要言語
C#
スター
1.9k
フォーク
194
平均マージ
12分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

reactivemarbles/DynamicData のほかの issue

reactivemarbles/DynamicData の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。