Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🔨 Allow viewing poll with no options

Luke Vella88c86eae180c
diff --git a/apps/web/src/app/[locale]/(admin)/poll/[urlId]/edit-options/page.tsx b/apps/web/src/app/[locale]/(admin)/poll/[urlId]/edit-options/page.tsx
index fdde82681..a1ffa4095 100644
--- a/apps/web/src/app/[locale]/(admin)/poll/[urlId]/edit-options/page.tsx
+++ b/apps/web/src/app/[locale]/(admin)/poll/[urlId]/edit-options/page.tsx
@@ -39,7 +39,7 @@ const Page = () => {
};
const form = useForm<PollOptionsData>({
defaultValues: {
- navigationDate: dayjs(poll.options[0].start).utc().format("YYYY-MM-DD"),
+ navigationDate: dayjs(poll.options[0]?.start).utc().format("YYYY-MM-DD"),
view: "month",
options: poll.options.map((option) => {
const start = dayjs(option.start).utc();
@@ -58,7 +58,7 @@ const Page = () => {
};
}),
timeZone: poll.timeZone ?? "",
- duration: poll.options[0].duration || 60,
+ duration: poll.options[0]?.duration || 60,
},
});
return (
diff --git a/apps/web/src/components/poll/desktop-poll.tsx b/apps/web/src/components/poll/desktop-poll.tsx
index 41f08af5c..e6deb6648 100644
--- a/apps/web/src/components/poll/desktop-poll.tsx
+++ b/apps/web/src/components/poll/desktop-poll.tsx
@@ -222,7 +222,7 @@ const DesktopPoll: React.FunctionComponent = () => {
) : null}
</div>
</div>
- {poll.options[0].duration !== 0 && poll.timeZone ? (
+ {poll.options[0]?.duration !== 0 && poll.timeZone ? (
<div className="border-b bg-gray-50 p-3">
<TimesShownIn />
</div>