mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
fix: unattended component reload due to session changes (#407)
* fix: unattended component reload due to session changes When the session is updated, status goes back to loading then authenticated or unauthenticated. session.accessTokenExpires may also be updated. This triggered various component refresh at unattented times, and brake the user experience. By splitting to only what's needed with memoization, it will prevent unattented refresh. * review * review: change syntax
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useSession } from "next-auth/react";
|
||||
|
||||
import { GetTranscript } from "../../api";
|
||||
import Pagination from "./pagination";
|
||||
@@ -13,6 +12,7 @@ import { formatTimeMs } from "../../lib/time";
|
||||
import useApi from "../../lib/useApi";
|
||||
import { useError } from "../../(errors)/errorContext";
|
||||
import { FaEllipsisVertical } from "react-icons/fa6";
|
||||
import useSessionUser from "../../lib/useSessionUser";
|
||||
import {
|
||||
Flex,
|
||||
Spinner,
|
||||
@@ -45,7 +45,7 @@ import { ExpandableText } from "../../lib/expandableText";
|
||||
export default function TranscriptBrowser() {
|
||||
const [page, setPage] = useState<number>(1);
|
||||
const { loading, response, refetch } = useTranscriptList(page);
|
||||
const { data: session } = useSession();
|
||||
const userName = useSessionUser().name;
|
||||
const [deletionLoading, setDeletionLoading] = useState(false);
|
||||
const api = useApi();
|
||||
const { setError } = useError();
|
||||
@@ -136,8 +136,8 @@ export default function TranscriptBrowser() {
|
||||
flexWrap={"wrap-reverse"}
|
||||
mt={4}
|
||||
>
|
||||
{session?.user?.name ? (
|
||||
<Heading size="md">{session?.user?.name}'s Meetings</Heading>
|
||||
{userName ? (
|
||||
<Heading size="md">{userName}'s Meetings</Heading>
|
||||
) : (
|
||||
<Heading size="md">Your meetings</Heading>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user