Skip to content

Commit

Permalink
Merge branch 'master' into chore/oct-1551-change-cypress-version
Browse files Browse the repository at this point in the history
  • Loading branch information
aziolek committed May 1, 2024
2 parents 848e8b6 + 2dee3d4 commit 5c42bbe
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
4 changes: 3 additions & 1 deletion client/cypress/e2e/projects.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight }) =>
}
});

it('user is able to add & remove the first and the last project to/from allocation, triggering change of the icon, change of the number in navbar', () => {
// TODO OCT-1611 enable this test.
// eslint-disable-next-line jest/no-disabled-tests
it.skip('user is able to add & remove the first and the last project to/from allocation, triggering change of the icon, change of the number in navbar', () => {
// This test checks the first and the last elements only to save time.
cy.get('[data-test=Navbar__numberOfAllocations]').should('not.exist');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ const MetricsEpochGridFundsUsage: FC<MetricsEpochGridFundsUsageProps> = ({
if (epoch === currentEpoch - 1 && isDecisionWindowOpen) {
return unusedRewards + ethBelowThreshold;
}
// TODO OCT-1612 OCT-1614 remove this bypass.
if (epoch === 3) {
return 3854465046588467390n;
}
return leftover;
}, [ethBelowThreshold, epoch, currentEpoch, isDecisionWindowOpen, leftover, unusedRewards]);

Expand Down
9 changes: 4 additions & 5 deletions client/src/hooks/helpers/useEpochPatronsAllEpochs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ export default function useEpochPatronsAllEpochs({
const epochPatronsAllEpochs: UseQueryResult<Response>[] = useQueries({
queries: [...Array(currentEpoch).keys()].map(epoch => ({
enabled: currentEpoch !== undefined && currentEpoch > 1 && isEnabledAdditional,
queryFn: async () => {
try {
return await apiGetEpochPatrons(epoch);
} catch (error) {
// For epoch 0 BE returns an error.
queryFn: () => {
// For Epoch 0 error 400 is returned.
if (epoch === 0) {
return new Promise<Response>(resolve => {
resolve({ patrons: [] });
});
}
return apiGetEpochPatrons(epoch);
},
queryKey: QUERY_KEYS.epochPatrons(epoch),
retry: false,
Expand Down
8 changes: 4 additions & 4 deletions client/src/hooks/helpers/useIndividualRewardAllEpochs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export default function useIndividualRewardAllEpochs({
const individualRewardAllEpochs = useQueries({
queries: [...Array(currentEpoch).keys()].map(epoch => ({
enabled: !!address && currentEpoch !== undefined && currentEpoch > 1 && isEnabledAdditional,
queryFn: async () => {
try {
return await apiGetIndividualRewards(epoch, address!);
} catch (error) {
queryFn: () => {
// For Epoch 0 and Epoch 1 error 400 is returned.
if ([0, 1].includes(epoch)) {
return new Promise<Response>(resolve => {
resolve({ budget: '0' });
});
}
return apiGetIndividualRewards(epoch, address!);
},
queryKey: QUERY_KEYS.individualReward(epoch),
retry: false,
Expand Down
7 changes: 3 additions & 4 deletions client/src/hooks/helpers/useUserAllocationsAllEpochs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@ export default function useUserAllocationsAllEpochs(): { data: Response; isFetch
const userAllocationsAllEpochs: UseQueryResult<ApiResponse>[] = useQueries({
queries: [...Array(currentEpoch).keys()].map(epoch => ({
enabled: !!address && currentEpoch !== undefined && currentEpoch > 1,
queryFn: async () => {
queryFn: () => {
// For Epoch 0 error 400 is returned.
try {
return await apiGetUserAllocations(address as string, epoch);
} catch (error) {
if (epoch === 0) {
return new Promise<ApiResponse>(resolve => {
resolve({
allocations: [],
isManuallyEdited: false,
});
});
}
return apiGetUserAllocations(address as string, epoch);
},
queryKey: QUERY_KEYS.userAllocations(epoch),
retry: false,
Expand Down

0 comments on commit 5c42bbe

Please sign in to comment.