<commit_before>import { Conversation_conversation } from "__generated__/Conversation_conversation.graphql"
import { SendConversationMessageMutation } from "__generated__/SendConversationMessageMutation.graphql"
import {
  commitMutation,
  ConnectionHandler,
  Environment,
  graphql,
  MutationConfig,
  RecordSourceSelectorProxy,
} from "relay-runtime"

export const SendConversationMessage = (
  environment: Environment,
  conversation: Conversation_conversation,
  text: string,
  onCompleted: MutationConfig<any>["onCompleted"],
  onError: MutationConfig<any>["onError"]
) => {
  const storeUpdater = (store: RecordSourceSelectorProxy) => {
    const mutationPayload = store.getRootField("sendConversationMessage")
    const newMessageEdge = mutationPayload.getLinkedRecord("messageEdge")
    const conversationStore = store.get(conversation.id)
    const connection = ConnectionHandler.getConnection(
      conversationStore,
      "Messages_messages"
    )
    ConnectionHandler.insertEdgeAfter(connection, newMessageEdge)<commit_msg>switched optimistic response message order<commit_after>import { Conversation_conversation } from "__generated__/Conversation_conversation.graphql"
import { SendConversationMessageMutation } from "__generated__/SendConversationMessageMutation.graphql"
import {
  ConnectionHandler,
  Environment,
  MutationConfig,
  RecordSourceSelectorProxy,
  commitMutation,
  graphql,
} from "relay-runtime"

export const SendConversationMessage = (
  environment: Environment,
  conversation: Conversation_conversation,
  text: string,
  onCompleted: MutationConfig<any>["onCompleted"],
  onError: MutationConfig<any>["onError"]
) => {
  const storeUpdater = (store: RecordSourceSelectorProxy) => {
    const mutationPayload = store.getRootField("sendConversationMessage")
    const newMessageEdge = mutationPayload.getLinkedRecord("messageEdge")
    const conversationStore = store.get(conversation.id)
    const connection = ConnectionHandler.getConnection(
      conversationStore,
      "Messages_messages"
    )
    ConnectionHandler.insertEdgeBefore(connection, newMessageEdge)
{'fraction_non_alphanumeric': 0.08325449385052035, 'fraction_numerical': 0.0, 'mean_word_length': 6.421052631578948, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5933444', 'n_tokens_mistral': 557, 'n_tokens_neox': 560, 'n_words': 103}