From 003334530dca673058760f81204ef377571ab301 Mon Sep 17 00:00:00 2001 From: Janvi <127668005+inkerton@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:33:56 +0000 Subject: [PATCH] Runtime error solved --- src/app/guestbook/page.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/guestbook/page.jsx b/src/app/guestbook/page.jsx index a63e23d..ed997cd 100644 --- a/src/app/guestbook/page.jsx +++ b/src/app/guestbook/page.jsx @@ -37,7 +37,9 @@ function Guestbook() { try { const res = await fetch("/api/guestbook/entries"); const data = await res.json(); - setEntries(data); + // setEntries(data); + setEntries(Array.isArray(data) ? data : []); + } catch (error) { console.error("Failed to fetch guestbook entries", error); } finally {