<commit_before>import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useHistory, useLocation } from "react-router-dom";
import { useTimeout } from "react-use";
import useSWR, { mutate } from "swr";
import useSWRInfinite from "swr/infinite";
import { validate as uuidValidate } from "uuid";

import axios from "@agir/lib/utils/axios";
import * as groupAPI from "@agir/groups/api";
import { routeConfig } from "@agir/front/app/routes.config";
import { setBackLink } from "@agir/front/globalContext/actions";
import { useDispatch } from "@agir/front/globalContext/GlobalContext";

const MESSAGES_LIST_SIZE = 5;
const COMMENTS_LIST_SIZE = 5;

export const useUnreadMessageCount = () => {
  const [isReady] = useTimeout(3000);
  const { data: session } = useSWR("/api/session/");
  const ready = isReady() && session?.user;
  const { data } = useSWR(ready && "/api/user/messages/unread_count/", {
    refreshInterval: 10000,
    dedupingInterval: 10000,
    focusThrottleInterval: 10000,
    shouldRetryOnError: false,
    revalidateIfStale: false,
  });

  return data?.unreadMessageCount && !isNaN(parseInt(data.unreadMessageCount))
    ? parseInt(data.unreadMessageCount)
    : 0;
};

export const useCommentsSWR = (messagePk) => {<commit_msg>fix: re-set lazy list sizes<commit_after>import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useHistory, useLocation } from "react-router-dom";
import { useTimeout } from "react-use";
import useSWR, { mutate } from "swr";
import useSWRInfinite from "swr/infinite";
import { validate as uuidValidate } from "uuid";

import axios from "@agir/lib/utils/axios";
import * as groupAPI from "@agir/groups/api";
import { routeConfig } from "@agir/front/app/routes.config";
import { setBackLink } from "@agir/front/globalContext/actions";
import { useDispatch } from "@agir/front/globalContext/GlobalContext";

const MESSAGES_LIST_SIZE = 10;
const COMMENTS_LIST_SIZE = 15;

export const useUnreadMessageCount = () => {
  const [isReady] = useTimeout(3000);
  const { data: session } = useSWR("/api/session/");
  const ready = isReady() && session?.user;
  const { data } = useSWR(ready && "/api/user/messages/unread_count/", {
    refreshInterval: 10000,
    dedupingInterval: 10000,
    focusThrottleInterval: 10000,
    shouldRetryOnError: false,
    revalidateIfStale: false,
  });

  return data?.unreadMessageCount && !isNaN(parseInt(data.unreadMessageCount))
    ? parseInt(data.unreadMessageCount)
    : 0;
};

export const useCommentsSWR = (messagePk) => {
{'fraction_non_alphanumeric': 0.1344800625488663, 'fraction_numerical': 0.017982799061767005, 'mean_word_length': 4.923611111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4921210', 'n_tokens_mistral': 866, 'n_tokens_neox': 829, 'n_words': 196}