perf: eliminate redundant derived state in board and post views

This commit is contained in:
plebeius
2025-10-16 23:13:18 +02:00
parent d57bf88586
commit b10ada55e7
4 changed files with 48 additions and 48 deletions
+1 -9
View File
@@ -269,15 +269,7 @@ const Board = () => {
document.title = boardTitle + ' - plebchan';
}, [title, shortAddress, subplebbitAddress]);
// probably not necessary to show the error to the user if the feed loaded successfully
const [shouldShowErrorToUser, setShouldShowErrorToUser] = useState(false);
useEffect(() => {
if (error?.message && feed.length === 0) {
setShouldShowErrorToUser(true);
} else if (feed.length > 0) {
setShouldShowErrorToUser(false);
}
}, [error, feed]);
const shouldShowErrorToUser = error?.message && feed.length === 0;
return (
<>