Skip to content

Commit

Permalink
feat: get recycled items (#1561)
Browse files Browse the repository at this point in the history
* feat: get recycled items

* refactor: update graasp query client
  • Loading branch information
pyphilia authored Nov 4, 2024
1 parent bbe3270 commit 114b7e3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cypress/support/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export const mockGetOwnRecycledItemData = (
);

reply({
data: result,
data: result.map(({ item }) => item),
totalCount: recycledItemData.length,
pagination: { page: 1, pageSize: ITEM_PAGE_SIZE },
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@emotion/styled": "11.13.0",
"@graasp/chatbox": "3.3.0",
"@graasp/map": "1.19.0",
"@graasp/query-client": "5.0.0",
"@graasp/query-client": "5.2.0",
"@graasp/sdk": "4.32.1",
"@graasp/stylis-plugin-rtl": "2.2.0",
"@graasp/translations": "1.40.0",
Expand Down
6 changes: 2 additions & 4 deletions src/components/pages/RecycledItemsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const RecycledItemsScreenContent = (): JSX.Element => {
const { t: translateBuilder } = useBuilderTranslation();

const { data, fetchNextPage, isLoading, isFetching } =
hooks.useInfiniteOwnRecycledItemData(
hooks.useInfiniteOwnRecycledItems(
// todo: adapt page size given the user window height
{ pageSize: ITEM_PAGE_SIZE },
);
Expand All @@ -45,9 +45,7 @@ const RecycledItemsScreenContent = (): JSX.Element => {
// render this when there is data from the query
if (data?.pages?.length) {
if (data.pages[0].data.length) {
const fetchedItems = data.pages
.flatMap((p) => p.data)
?.map((p) => p.item);
const fetchedItems = data.pages.flatMap((p) => p.data);

const totalFetchedItems = fetchedItems.length;

Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1625,9 +1625,9 @@ __metadata:
languageName: node
linkType: hard

"@graasp/query-client@npm:5.0.0":
version: 5.0.0
resolution: "@graasp/query-client@npm:5.0.0"
"@graasp/query-client@npm:5.2.0":
version: 5.2.0
resolution: "@graasp/query-client@npm:5.2.0"
dependencies:
"@tanstack/react-query": "npm:5.59.8"
"@tanstack/react-query-devtools": "npm:5.59.8"
Expand All @@ -1637,7 +1637,7 @@ __metadata:
"@graasp/sdk": ^4.0.0
"@graasp/translations": "*"
react: ^18.0.0
checksum: 10/463dd556081d76fb2cb4bcf69b595560eb40ff528de5b1c64f189af106209bf394135d400374c80c031a57b0e3a13fdedd12d4d86988a4533b49d37c405a662a
checksum: 10/442ac0b18656210584d4be90672b9f9bfc054e719b9bbc60ec23ac40e8501acf0d51f0485abb6b4d8822d68766c38235fa54685ad5ead55ae1ce1f922e5c4d4f
languageName: node
linkType: hard

Expand Down Expand Up @@ -6402,7 +6402,7 @@ __metadata:
"@emotion/styled": "npm:11.13.0"
"@graasp/chatbox": "npm:3.3.0"
"@graasp/map": "npm:1.19.0"
"@graasp/query-client": "npm:5.0.0"
"@graasp/query-client": "npm:5.2.0"
"@graasp/sdk": "npm:4.32.1"
"@graasp/stylis-plugin-rtl": "npm:2.2.0"
"@graasp/translations": "npm:1.40.0"
Expand Down

0 comments on commit 114b7e3

Please sign in to comment.