Skip to content

Ordered entities #316

Closed
Closed
@jamakase

Description

@jamakase

In some cases, it could be useful to store and display data in timed order. Like messages in the chat.

I tried to implement the receiving of new messages via custom redux action, but we know only ids of entities in updaters, so it is not possible to identify where to store entity.

export const conversationUpdated = (conversationUpdate: ConversationByOperator) => ({
  type: RECEIVE_MUTATE_TYPE,
  payload: conversationUpdate,
  meta: {
    schema: ConversationByOperatorResource.asSchema(),
    updaters: {
      [ConversationByOperatorResource.listShape().getFetchKey({})]: (
        newConvId: string,
        prevResults: { conversations: string[] | undefined },
      ) => ({
        conversations: [...(prevResults?.conversations ?? []), newConvId],
      }),
    },
    date: new Date(),
    expiresAt: 189231293812939889,
  },
});

Do you know how this can be done except manually sorting everything in react components?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions