From 56dc8bbe0786c51d3e7263ab1780409027a6c37b Mon Sep 17 00:00:00 2001 From: nicktytarenko Date: Wed, 17 Jun 2026 23:26:59 +0300 Subject: [PATCH 1/4] Fix profile member text and funding modal navigation flash. --- .../Funding/OpenFundingOpportunityModal.tsx | 42 ++++++++++++++----- components/profile/ProfileHeroBanner.tsx | 10 ++++- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/components/Funding/OpenFundingOpportunityModal.tsx b/components/Funding/OpenFundingOpportunityModal.tsx index 2697310a9..97d462633 100644 --- a/components/Funding/OpenFundingOpportunityModal.tsx +++ b/components/Funding/OpenFundingOpportunityModal.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useEffect, useState } from 'react'; +import { useEffect, useState, useTransition } from 'react'; import Link from 'next/link'; import { Dialog } from '@headlessui/react'; import { @@ -109,17 +109,36 @@ export const OpenFundingOpportunityModal = ({ }: OpenFundingOpportunityModalProps) => { const initialStep: Step = minimal ? 'method' : 'benefits'; const [step, setStep] = useState(initialStep); + const [pendingMethod, setPendingMethod] = useState(null); + const [isPending, startTransition] = useTransition(); + + const handleClose = () => { + if (isPending) return; + onClose(); + }; + + const handleConfirmMethod = (method: FundingOpportunityCreationMethod) => { + setPendingMethod(method); + startTransition(() => { + onConfirm(method); + }); + }; // Reset to the first step whenever the modal is reopened so a returning user // always starts from the configured entry step rather than a stale step. + // Skip while a route transition is pending so the method step doesn't flash + // back to the initial step before navigation completes. useEffect(() => { - if (!isOpen) setStep(initialStep); - }, [isOpen, initialStep]); + if (!isOpen && !isPending) { + setStep(initialStep); + setPendingMethod(null); + } + }, [isOpen, initialStep, isPending]); return ( @@ -172,7 +191,7 @@ export const OpenFundingOpportunityModal = ({