mirror of https://github.com/fantasticit/think.git
fix: only fetch wiki tocs with wikiId change
parent
eb49ffa20b
commit
c0235cdd0a
|
@ -41,7 +41,7 @@ export const WikiTocs: React.FC<IProps> = ({
|
|||
data: tocs,
|
||||
loading: tocsLoading,
|
||||
error: tocsError,
|
||||
} = useWikiTocs(wikiId, documentId);
|
||||
} = useWikiTocs(wikiId);
|
||||
const [parentIds, setParentIds] = useState<Array<string>>([]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -89,7 +89,6 @@ export const Tree = ({
|
|||
ellipsis={{
|
||||
showTooltip: { opts: { content: label, position: "right" } },
|
||||
}}
|
||||
style={{ color: "inherit" }}
|
||||
>
|
||||
{label}
|
||||
</Typography.Text>
|
||||
|
|
|
@ -100,12 +100,12 @@ export const useWikiHomeDoc = (wikiId) => {
|
|||
* @param workspaceId
|
||||
* @returns
|
||||
*/
|
||||
export const useWikiTocs = (wikiId, documentId = null) => {
|
||||
export const useWikiTocs = (wikiId) => {
|
||||
const { data, error, mutate } = useSWR<
|
||||
Array<IDocument & { createUser: IUser }>
|
||||
>(
|
||||
`/wiki/tocs/${wikiId}/documentId/${documentId}`,
|
||||
wikiId ? () => HttpClient.get(`/wiki/tocs/${wikiId}`) : null
|
||||
`/wiki/tocs/${wikiId}`,
|
||||
(url) => HttpClient.get(url)
|
||||
);
|
||||
const loading = !data && !error;
|
||||
|
||||
|
|
Loading…
Reference in New Issue