Mod tab fix

This commit is contained in:
2026-04-04 23:50:30 +02:00
parent 7166ab0835
commit d44fc53016
+12 -4
View File
@@ -42,7 +42,6 @@ const ModsSection: React.FC<ModsSectionProps> = ({ version }) => {
string[] string[]
>([]); >([]);
useEffect(() => {
const loadMods = async () => { const loadMods = async () => {
if (activeTab === "installed") { if (activeTab === "installed") {
const m = await getInstalledMods(version.id); const m = await getInstalledMods(version.id);
@@ -56,10 +55,15 @@ const ModsSection: React.FC<ModsSectionProps> = ({ version }) => {
} }
}; };
useEffect(() => {
const id = setTimeout(loadMods, 800); const id = setTimeout(loadMods, 800);
return () => clearTimeout(id); return () => clearTimeout(id);
}, [activeTab, version.id, searchQuery]); }, [version.id, searchQuery]);
useEffect(() => {
setMods([]);
loadMods();
}, [activeTab]);
const handleToggleMod = async (modId: string, enable: boolean) => { const handleToggleMod = async (modId: string, enable: boolean) => {
if (enable) await enableMod(version.id, modId); if (enable) await enableMod(version.id, modId);
@@ -152,7 +156,11 @@ const ModsSection: React.FC<ModsSectionProps> = ({ version }) => {
> >
<div className="w-12 h-12 rounded-lg bg-zinc-800 border border-saturn-border flex items-center justify-center shrink-0"> <div className="w-12 h-12 rounded-lg bg-zinc-800 border border-saturn-border flex items-center justify-center shrink-0">
{mod.icon ? ( {mod.icon ? (
<img src={mod.icon} alt="Mod Icon" className="w-full h-full rounded-lg" /> <img
src={mod.icon}
alt="Mod Icon"
className="w-full h-full rounded-lg"
/>
) : ( ) : (
<Package size={24} className="text-saturn-text-secondary" /> <Package size={24} className="text-saturn-text-secondary" />
)} )}