Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/app/reset-password/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useLayoutEffect, useState, type ReactElement } from "react";
import { useEffect, useLayoutEffect, useState, type ReactElement } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import {
Expand All @@ -14,7 +14,6 @@ import styles from "@/styles/login.module.css";
type AlertState = { type: "success" | "error"; message: string } | null;

export default function Page(): ReactElement {
const supabase = createClient();
const router = useRouter();

const [password, setPassword] = useState("");
Expand All @@ -23,6 +22,13 @@ export default function Page(): ReactElement {
const [updating, setUpdating] = useState(false);
const [bootstrapping, setBootstrapping] = useState(true);
const [bootMessage, setBootMessage] = useState("Loading…");
const [supabase, setSupabase] = useState<ReturnType<
typeof createClient
> | null>(null);

useEffect(() => {
setSupabase(createClient());
}, []);

useLayoutEffect(() => {
const code = new URLSearchParams(window.location.search).get("code");
Expand Down Expand Up @@ -65,6 +71,14 @@ export default function Page(): ReactElement {
): Promise<void> => {
event.preventDefault();

if (!supabase) {
setAlert({
type: "error",
message: "Reset session is still loading. Please try again.",
});
return;
}

if (!password.trim()) {
setAlert({ type: "error", message: "Please enter a new password." });
return;
Expand Down Expand Up @@ -159,7 +173,7 @@ export default function Page(): ReactElement {

<button
type="submit"
disabled={updating}
disabled={updating || !supabase}
className={styles["submitButton"]}
>
{updating ? "Updating…" : "Update password"}
Expand Down
2 changes: 1 addition & 1 deletion src/components/volunteers/VolunteersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ const VolunteersTableContent = ({
/** Filtered rows in table sort order (matches column headers), for shortcuts like copy-all emails/phones. */
const visibleVolunteersSorted = useMemo(
() => table.getSortedRowModel().rows.map((r) => r.original),
[table, data, sorting, debouncedGlobalFilter]
[table]
);

const {
Expand Down
Loading