#TypeError [ERR_INVALID_STATE]: Invalid state: ReadableStream is already closed

4 messages · Page 1 of 1 (latest)

rancid skiff
#

I don't understand the essence of the problem, my program is safe, there are no bugs, and when it is built there are no problems either, but this always appears, when executing this code:

  const handleNavigation = (e: MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => {
    e.stopPropagation()

    if (isPending) return;

    window.location.href = `/${dataNotification.sourceUser?.username}`

    // Kode ini di bawah sini. cmiiw.
    if (!dataNotification.isRead) {
      startTransition(() => {
        markAsReadNotification(dataNotification.id, path)
      })
    }
  }

export const markAsReadNotification = async (
    notificationId: string,
    path: string
) => {
    if (!notificationId) throw new Error("notificationId required");
    if (!path) throw new Error("path required");

    try {
        await prisma.notification.update({
            where: { id: notificationId },
            data: {
                isRead: true,
            },
        });
    } catch (error) {
        console.info("[ERROR_MARK_AS_READ_NOTIFICATION]", error);
    } finally {
        revalidatePath(path);
    }
};
pale frostBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

remote night
#

I have the same error and I'm almost sure it happens on the server

remote night