[Glitch] Fix WebUI fetching deleted quote in an endless loop

Port 3c9bde31f7 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Claire
2025-08-26 12:07:02 +02:00
parent 0710138578
commit f825b0cfa4

View File

@@ -84,12 +84,13 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
const status = useAppSelector((state) =>
quotedStatusId ? state.statuses.get(quotedStatusId) : undefined,
);
const isQuoteLoaded = !!status && !status.get('isLoading');
useEffect(() => {
if (!status && quotedStatusId) {
if (!isQuoteLoaded && quotedStatusId) {
dispatch(fetchStatus(quotedStatusId));
}
}, [status, quotedStatusId, dispatch]);
}, [isQuoteLoaded, quotedStatusId, dispatch]);
// In order to find out whether the quoted post should be completely hidden
// due to a matching filter, we run it through the selector used by `status_container`.