Skip to content

hotfix: session bugging a bit when clicking around #3465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions web/components/templates/sessions/sessionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,31 @@ const SessionsPage = (props: SessionsPageProps) => {
hasAccess,
]);

const isAnyLoading = useMemo(() => {
return (
isLoading ||
allNames.isLoading ||
allNames.isRefetching ||
isLoading ||
names.isLoading ||
names.isRefetching
);
Comment on lines +139 to +146
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: isLoading is listed twice in the conditions, which is redundant and may mask other loading states

Suggested change
return (
isLoading ||
allNames.isLoading ||
allNames.isRefetching ||
isLoading ||
names.isLoading ||
names.isRefetching
);
return (
isLoading ||
allNames.isLoading ||
allNames.isRefetching ||
names.isLoading ||
names.isRefetching
);

}, [
isLoading,
allNames.isLoading,
allNames.isRefetching,
names.isLoading,
names.isRefetching,
]);

return (
<Tabs
value={currentTab}
onValueChange={(value) => setCurrentTab(value)}
className="w-full"
>
<div>
{hasSomeSessions || isLoading ? (
{hasSomeSessions || isAnyLoading ? (
<>
<AuthHeader
isWithinIsland={true}
Expand Down Expand Up @@ -193,14 +210,7 @@ const SessionsPage = (props: SessionsPageProps) => {
sessionIdSearch={sessionIdSearch ?? ""}
setSessionIdSearch={setSessionIdSearch}
sessions={sessions}
isLoading={
isLoading ||
allNames.isLoading ||
allNames.isRefetching ||
isLoading ||
names.isLoading ||
names.isRefetching
}
isLoading={isAnyLoading}
sort={sort}
timeFilter={timeFilter}
setTimeFilter={setTimeFilter}
Expand Down
18 changes: 10 additions & 8 deletions web/pages/sessions/[session_id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const SessionDetail = ({ session_id }: { session_id: string }) => {
return new Date(Date.now() - 30 * 24 * 60 * 60 * 1000 * 3);
}, []);

const [isLive, setIsLive] = useState(true);
const [isLive, setIsLive] = useState(false);
const requests = useGetRequests(
1,
1000,
Expand Down Expand Up @@ -43,13 +43,15 @@ const SessionDetail = ({ session_id }: { session_id: string }) => {
const session = sessionFromHeliconeRequests(requests.requests.requests ?? []);

return (
<SessionContent
session={session}
session_id={session_id as string}
requests={requests}
isLive={isLive}
setIsLive={setIsLive}
/>
<>
<SessionContent
session={session}
session_id={session_id as string}
requests={requests}
isLive={isLive}
setIsLive={setIsLive}
/>
</>
);
};

Expand Down
Loading