Use MessageChannels to self-delete queue items

Previous method would cause site to die
This commit is contained in:
2023-10-24 00:32:53 -04:00
parent 912cd0581a
commit 5d38bae59c
5 changed files with 75 additions and 36 deletions

View File

@ -21,7 +21,7 @@ import {
} from "@chakra-ui/react";
import { useEffect, useState } from "react";
export default function(props: AppealCardProps) {
export default function(props: AppealCardProps & { port?: MessagePort }) {
const [dateString, setDateString] = useState(
new Date(props.created_at).toUTCString()
);
@ -80,7 +80,7 @@ export default function(props: AppealCardProps) {
onClose();
setLoading(false);
document.getElementById(`appeal_${props.id}`)?.remove();
props.port?.postMessage(`appeal_${props.id}`);
}
return (