Documented createDataSource, DataSource & DataSourceView

Summary: Per title

Reviewed By: nikoant

Differential Revision: D26978363

fbshipit-source-id: b3cfeda0fb0f6556e1ba9041325ae080cba69a7b
This commit is contained in:
Michel Weststrate
2021-03-16 14:54:53 -07:00
committed by Facebook GitHub Bot
parent 602152665b
commit be25df6490
2 changed files with 220 additions and 5 deletions

View File

@@ -23,8 +23,6 @@ const defaultLimit = 100 * 1000;
// rather than search and remove the affected individual items
const shiftRebuildTreshold = 0.05;
// TODO: expose interface with public members only
type ExtractKeyType<T, KEY extends keyof T> = T[KEY] extends string
? string
: T[KEY] extends number
@@ -707,8 +705,8 @@ class DataSourceView<T> {
this.notifyItemUpdated(existingIndex);
} else {
// item needs to be moved cause of sorting
// TODO: possible optimization: if we discover that old and new index would be the same,
// despite different sort values, we could still only emit an update
// possible optimization: if we discover that old and new index would be the same,
// despite different sort values, we could still emit only an update instead of two shifts
output.splice(existingIndex, 1);
this.notifyItemShift(existingIndex, -1);
// find new sort index