diff --git a/src/components/v2v3/V2V3Project/ProjectDashboard/components/CyclesPayoutsPanel/components/CurrentUpcomingSubPanel.tsx b/src/components/v2v3/V2V3Project/ProjectDashboard/components/CyclesPayoutsPanel/components/CurrentUpcomingSubPanel.tsx
index e01ced6f9a..2dccaf841f 100644
--- a/src/components/v2v3/V2V3Project/ProjectDashboard/components/CyclesPayoutsPanel/components/CurrentUpcomingSubPanel.tsx
+++ b/src/components/v2v3/V2V3Project/ProjectDashboard/components/CyclesPayoutsPanel/components/CurrentUpcomingSubPanel.tsx
@@ -63,7 +63,7 @@ export const CurrentUpcomingSubPanel = ({
)
- const hasNoUpcomingCycle =
+ if (
info.type === 'upcoming' &&
info.currentCycleUnlocked &&
/**
@@ -71,10 +71,8 @@ export const CurrentUpcomingSubPanel = ({
* (which happens when Scheduled Launch is used,
* mustStartAtOrAfter is in the future)
*/
- info.cycleNumber !== 1 &&
- !info.hasPendingConfiguration
-
- if (hasNoUpcomingCycle) {
+ info.cycleNumber !== 1
+ ) {
return (
{
@@ -16,14 +15,8 @@ export const useCurrentUpcomingSubPanel = (type: 'current' | 'upcoming') => {
const {
data: upcomingFundingCycleData,
loading: upcomingFundingCycleLoading,
- } = useProjectUpcomingFundingCycle({
- projectId,
- /**
- * if the current cycle is unlocked, force the use of latestConfiguredFundingCycleOf.
- */
- useLatestConfigured: fundingCycle?.duration?.isZero() ?? false,
- })
- const [upcomingFundingCycle, , ballotState] = upcomingFundingCycleData ?? []
+ } = useProjectUpcomingFundingCycle({ projectId })
+ const [upcomingFundingCycle] = upcomingFundingCycleData ?? []
const { timeRemainingText } = useFundingCycleCountdown()
const cycleNumber = useMemo(() => {
@@ -40,6 +33,12 @@ export const useCurrentUpcomingSubPanel = (type: 'current' | 'upcoming') => {
return upcomingFundingCycle?.duration?.isZero() ?? true
}, [fundingCycle?.duration, type, upcomingFundingCycle?.duration])
+ /** Determines if the CURRENT cycle is unlocked.
+ * This is used to check if the upcoming cycle can start at any time. */
+ const currentCycleUnlocked = useMemo(() => {
+ return fundingCycle?.duration?.isZero() ?? true
+ }, [fundingCycle?.duration])
+
const upcomingCycleLength = useMemo(() => {
if (!upcomingFundingCycle) return
if (cycleUnlocked) return '-'
@@ -49,12 +48,15 @@ export const useCurrentUpcomingSubPanel = (type: 'current' | 'upcoming') => {
)
}, [cycleUnlocked, upcomingFundingCycle])
- /** Determines if the CURRENT cycle is unlocked.
- * This is used to check if the upcoming cycle can start at any time. */
- const currentCycleUnlocked = fundingCycle?.duration?.isZero() ?? true
+ const status = useMemo(() => {
+ if (cycleUnlocked) return t`Unlocked`
+ return t`Locked`
+ }, [cycleUnlocked])
- const status = cycleUnlocked ? t`Unlocked` : t`Locked`
- const remainingTime = cycleUnlocked ? '-' : timeRemainingText
+ const remainingTime = useMemo(() => {
+ if (cycleUnlocked) return '-'
+ return timeRemainingText
+ }, [cycleUnlocked, timeRemainingText])
// Short circuit current for faster loading
if (type === 'current') {
@@ -82,14 +84,5 @@ export const useCurrentUpcomingSubPanel = (type: 'current' | 'upcoming') => {
cycleLength: upcomingCycleLength,
cycleUnlocked,
currentCycleUnlocked,
- hasPendingConfiguration:
- /**
- * If a cycle is unlocked, it may have a pending change.
- * The only way it would, is if the ballot state of the latestConfiguredFC is `approved`.
- */
- cycleUnlocked &&
- typeof ballotState !== 'undefined' &&
- ballotState !== null &&
- ballotState === BallotState.approved,
}
}
diff --git a/src/hooks/v2v3/contractReader/useProjectUpcomingFundingCycle.ts b/src/hooks/v2v3/contractReader/useProjectUpcomingFundingCycle.ts
index cfb2636303..df50f98cbb 100644
--- a/src/hooks/v2v3/contractReader/useProjectUpcomingFundingCycle.ts
+++ b/src/hooks/v2v3/contractReader/useProjectUpcomingFundingCycle.ts
@@ -19,10 +19,8 @@ type UpcomingFundingCycleDataType = [
*/
export function useProjectUpcomingFundingCycle({
projectId,
- useLatestConfigured, // force latestConfiguredFundingCycleOf to be returned.
}: {
projectId: number | undefined
- useLatestConfigured?: boolean
}): ContractReadResult {
/**
* Get Latest Configured Funding Cycle.
@@ -40,9 +38,8 @@ export function useProjectUpcomingFundingCycle({
latestConfiguredFundingCycleBallotState,
] = latestConfiguredFundingCycleResponse ?? []
const isLatestConfiguredActive =
- (latestConfiguredFundingCycle &&
- latestConfiguredFundingCycleBallotState === BallotState.active) ||
- useLatestConfigured
+ latestConfiguredFundingCycle &&
+ latestConfiguredFundingCycleBallotState === BallotState.active
/**
* Get Queued Configured Funding Cycle, *only if* latestConfiguredFundingCycle isn't active.