diff --git a/web/src/components/Item.tsx b/web/src/components/Item.tsx index 1426fc4..a3ec140 100644 --- a/web/src/components/Item.tsx +++ b/web/src/components/Item.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import type { ItemDetails } from "../api/useItemsQuery"; import { useItemTorrentsQuery } from "../api/useItemTorrentsQuery"; import { @@ -39,6 +39,16 @@ export const Item = ({ item }: ItemProps) => { const Icon = open ? CaretUpIcon : CaretDownIcon; + useEffect(() => { + const params = new URLSearchParams(location.search); + const itemId = params.get("item"); + if (itemId && parseInt(itemId) === item.id) { + // fuck this stupid rule + // eslint-disable-next-line + setOpen(true); + } + }, [item]); + const handleDownloadTorrent = (torrentId: number) => { downloadMutation.mutate({ torrentId }); };