feat: generalize entity store in V10 - #1814
Open
isekovanic wants to merge 4 commits into
Open
Conversation
isekovanic
requested review from
MartinCupela,
arnautov-anton,
oliverlaz,
santhoshvai,
szuperaz and
vishalnarkhede
as code owners
August 5, 2026 18:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CLA
Description of the changes, What, Why and How?
Generalizes the
MessageStoreinto a reusable generic layer, makes the pinned message list reactive and collapses theItemIndexabstraction to a single implementation.What & Why
The reactive
MessageStoreand itsMessageStoreBackedItemIndexwere message specific, but nothing about them actually depends on message and the domain type is only used to pull anid. This PR lifts that into a generic, reusable core so any collection can share the same normalized/reactive machinery and removes redundant stuff.1.
MessageStorebecomes genericEntityStore<T>EntityStore<T>holds the entire former store body; its constructor takes an options object{ getId }(EntityStoreOptions<T>), matching theItemIndex({ getId })idiomMessageStoresubclass is deleted since it existed only to bindgetId.client.messageStoreis nownew EntityStore<LocalMessage>({ getId: (m) => m.id })MessageStoreBackedItemIndexbecomes a genericStoreBackedItemIndex<T>, with an optionalstore(falls back to a privateEntityStore, so a detached index behaves like a plain per-instance one)2. Pinned message list is now store backed
ItemIndexfactory has been moved up toMessageIntervalPaginator(common ancestor of the main list, thread replies and pinned list), soPinnedMessagePaginatornow shares the client global store instead of holding a privateItemIndex3. Delete the standalone
ItemIndexclassStoreBackedItemIndexis behaviorally identical to the oldItemIndex.owneris now optional too and so the four remainingnew ItemIndex(...)sites (Base default,Channel/Reminder/UserGrouppaginators) route throughStoreBackedItemIndex.ItemIndexclass andItemIndexOptionsare removed; theItemIndexApiinterface (the contractBasePaginatordepends on) is kept, now with a single implementationPublic API surface
MessageStore(class)EntityStore(class)MessageStoreChangeBatchEntityStoreChangeBatchMessageStoreSubscriberEntityStoreSubscriberEntityStoreOptionsTesting
yarn types,yarn lint(0 warnings),yarn buildall clean.reactions.optimistic.test.ts) and owner-less/store-less CRUD (StoreBackedItemIndex.test.ts). TheItemIndex.test.tssuite was folded intoStoreBackedItemIndex.test.ts.stream-chat-react-native.Changelog