Skip to content

Commit

Permalink
Fix tasklist when chainlit is submounted.
Browse files Browse the repository at this point in the history
  • Loading branch information
dokterbob committed Oct 14, 2024
1 parent e1e206b commit 4cd9643
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontend/src/components/molecules/tasklist/TaskList.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { useMemo } from 'react';
import useSWR from 'swr';
import { grey } from 'theme';

import { Box, Chip, List, Theme, useTheme } from '@mui/material';

import { useApi, useChatData } from '@chainlit/react-client';
import { useChatData } from '@chainlit/react-client';

import { Translator } from 'components/i18n';

import { ITaskList, Task } from './Task';

const fetcher = (url: string) => fetch(url).then((r) => r.json());

const Header = ({ status }: { status: string }) => {
const theme = useTheme();
return (
Expand Down Expand Up @@ -70,7 +73,7 @@ const TaskList = ({ isMobile }: { isMobile: boolean }) => {
return parsedUrl.pathname + parsedUrl.search;
}, [tasklist?.url]);

const { isLoading, error, data } = useApi<ITaskList>(url ? url : null, {
const { error, data, isLoading } = useSWR(url, fetcher, {
keepPreviousData: true
});

Expand All @@ -90,7 +93,7 @@ const TaskList = ({ isMobile }: { isMobile: boolean }) => {
);
}

const content = data as ITaskList;
const content = data as unknown as ITaskList;

if (!content) {
return null;
Expand Down

0 comments on commit 4cd9643

Please sign in to comment.