Fix react warnings
This commit is contained in:
parent
7df5cbb324
commit
79631cbc05
@ -1,6 +1,6 @@
|
||||
import { format } from "date-fns";
|
||||
import Head from "next/head";
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import useSWRImmutable from "swr/immutable";
|
||||
|
||||
import CellList from "./CellList";
|
||||
@ -50,6 +50,10 @@ const ModData: React.FC<Props> = ({
|
||||
(_) => jsonFetcher<Mod>(_)
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (data) setSelectedCells(data.cells);
|
||||
}, [data, setSelectedCells]);
|
||||
|
||||
if (error && error.status === 404) {
|
||||
return <div>Mod could not be found.</div>;
|
||||
} else if (error) {
|
||||
@ -66,8 +70,6 @@ const ModData: React.FC<Props> = ({
|
||||
const unique_downloads = modCounts ? modCounts[1] : 0;
|
||||
const views = modCounts ? modCounts[2] : 0;
|
||||
|
||||
setSelectedCells(data.cells);
|
||||
|
||||
if (selectedMod && data) {
|
||||
return (
|
||||
<>
|
||||
|
@ -58,7 +58,8 @@ const PluginsList: React.FC<Props> = ({ selectedCell }) => {
|
||||
disabled={
|
||||
excludedPlugins.includes(plugin.filename) || !!plugin.parseError
|
||||
}
|
||||
checked={plugin.enabled}
|
||||
checked={plugin.enabled ?? false}
|
||||
value={plugin.enabled ? "on" : "off"}
|
||||
onChange={() => dispatch(togglePlugin(plugin.filename))}
|
||||
/>
|
||||
<label htmlFor={plugin.filename} className={styles["plugin-label"]}>
|
||||
|
Loading…
Reference in New Issue
Block a user