Skip to content

Improve discusion refresh perf in DiscussionStore and messageStore #558

@fleandrei

Description

@fleandrei

In DiscussionStore.tsx,

sdk.on(SdkEventType.MESSAGE_RECEIVED, onEvent);
sdk.on(SdkEventType.MESSAGE_READ, onEvent);
sdk.on(SdkEventType.SESSION_CREATED, onEvent);
sdk.on(SdkEventType.SESSION_ACCEPTED, onEvent);
sdk.on(SdkEventType.SESSION_RENEWED, onEvent);
sdk.on(SdkEventType.SESSION_REQUESTED, onEvent);
sdk.on(SdkEventType.DISCUSSION_UPDATED, onEvent);
we reload all discussions. It would be better to filter pertinent events and reload from db only data that is required. For exammple when a message is received, we can just refetch the discussion corresponding to this message rather than all discusions.
Same logic for messageStore.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions