Skip to content

Commit 4cf24f9

Browse files
authored
Merge pull request #3929 from IntersectMBO/staging
Outcomes v1.5.3 - main
2 parents e605fbd + 55472f6 commit 4cf24f9

File tree

6 files changed

+36
-21
lines changed

6 files changed

+36
-21
lines changed

govtool/frontend/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

govtool/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@emotion/styled": "^11.11.0",
2828
"@emurgo/cardano-serialization-lib-asmjs": "^14.1.1",
2929
"@hookform/resolvers": "^3.3.1",
30-
"@intersect.mbo/govtool-outcomes-pillar-ui": "v1.5.2",
30+
"@intersect.mbo/govtool-outcomes-pillar-ui": "v1.5.3",
3131
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
3232
"@intersect.mbo/pdf-ui": "1.0.9-beta",
3333
"@mui/icons-material": "^5.14.3",

govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
DashboardGovernanceActionsVotedOn,
2323
} from "@organisms";
2424
import { Button } from "@atoms";
25+
import usePrevious from "@/hooks/usePrevious";
2526

2627
type TabPanelProps = {
2728
children?: React.ReactNode;
@@ -84,11 +85,17 @@ export const DashboardGovernanceActions = () => {
8485
const queryFilters =
8586
chosenFilters.length > 0 ? chosenFilters : defaultCategories;
8687

88+
const prevFilters = usePrevious(queryFilters);
89+
const prevSorting = usePrevious(chosenSorting);
90+
91+
const stableFilters = isAdjusting ? prevFilters ?? queryFilters : queryFilters;
92+
const stableSorting = isAdjusting ? prevSorting ?? chosenSorting : chosenSorting;
93+
8794
const { proposals, isProposalsLoading } = useGetProposalsQuery({
88-
filters: queryFilters,
89-
sorting: chosenSorting,
95+
filters: stableFilters,
96+
sorting: stableSorting,
9097
searchPhrase: debouncedSearchText,
91-
enabled: !isAdjusting,
98+
enabled: true,
9299
});
93100
const { data: votes, areDRepVotesLoading } = useGetDRepVotesQuery(
94101
queryFilters,

govtool/frontend/src/hooks/queries/useGetProposalsQuery.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@ export const useGetProposalsQuery = ({
3333
return allProposals.flatMap((proposal) => proposal.elements);
3434
};
3535

36-
const { data, isLoading } = useQuery(
37-
[QUERY_KEYS.useGetProposalsKey, filters, searchPhrase, sorting, dRepID],
38-
fetchProposals,
39-
{
40-
enabled,
41-
refetchOnWindowFocus: true,
42-
keepPreviousData: true,
43-
},
44-
);
36+
const { data, isLoading } = useQuery(
37+
[QUERY_KEYS.useGetProposalsKey, filters, searchPhrase, sorting, dRepID],
38+
fetchProposals,
39+
{
40+
enabled,
41+
refetchOnWindowFocus: true,
42+
keepPreviousData: true,
43+
staleTime: 2000,
44+
},
45+
);
4546

4647
const proposals = Object.values(groupByType(data) ?? []);
4748

tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,22 @@ test("11E. Should view comments with count indications on a budget proposal", as
247247

248248
const actualTotalComments =
249249
await budgetDiscussionDetailsPage.totalComments.textContent();
250-
const expectedTotalComments =
251-
proposalResponse.data.attributes.prop_comments_number.toString();
250+
let expectedTotalComments =
251+
proposalResponse.data.attributes.prop_comments_number;
252252
const isEqual = actualTotalComments === expectedTotalComments;
253253

254254
const currentPageUrl = budgetDiscussionDetailsPage.currentPage.url();
255255

256256
const proposalId = extractProposalIdFromUrl(currentPageUrl);
257+
if (expectedTotalComments > 99) {
258+
expectedTotalComments = "99+";
259+
}
257260

258261
await expect(
259262
budgetDiscussionDetailsPage.totalComments,
260263
!isEqual &&
261264
`Total comments do not match in ${environments.frontendUrl}/budget_discussion/${proposalId}`
262-
).toHaveText(expectedTotalComments);
265+
).toHaveText(expectedTotalComments.toString());
263266
});
264267

265268
test.describe("Restricted access to interact budget proposal", () => {

tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,12 @@ test.describe("Mocked proposal", () => {
292292
});
293293

294294
test("8F. Should display all comments with count indication.", async () => {
295+
let commentCount = mockProposal.data.attributes.prop_comments_number;
296+
if (commentCount > 99) {
297+
commentCount = "99+";
298+
}
295299
await expect(proposalDiscussionDetailsPage.commentCount).toHaveText(
296-
mockProposal.data.attributes.prop_comments_number.toString(),
300+
commentCount.toString(),
297301
{ timeout: 60_000 }
298302
);
299303
});

0 commit comments

Comments
 (0)