Repository: graasp/client
Pull request #993: fix: update for new sdk version
Author: login: spaenleh
Labels: name: dependencies
description: Pull requests that update a dependency file
name: v2.26.1
Created: 2025-05-05T13:02:59Z | Merged: 2025-05-09T12:29:37Z

In this PR I update the code with the changes made in SDK. Mainly concerned is the `TagCategory` that was moved from an enum to a const.



Diff:
diff --git a/package.json b/package.json
index 22158d9db..242011ff0 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
     "@emotion/react": "11.14.0",
     "@emotion/styled": "11.14.0",
     "@fontsource-variable/nunito": "5.1.1",
-    "@graasp/sdk": "5.13.0",
+    "@graasp/sdk": "5.13.1",
     "@graasp/stylis-plugin-rtl": "2.2.0",
     "@hey-api/client-fetch": "0.10.0",
     "@mui/icons-material": "6.4.4",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index bc96c302c..97dbb917e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -27,8 +27,8 @@ importers:
         specifier: 5.1.1
         version: 5.1.1
       '@graasp/sdk':
-        specifier: 5.13.0
-        version: 5.13.0(date-fns@4.1.0)(uuid@11.0.5)
+        specifier: 5.13.1
+        version: 5.13.1(date-fns@4.1.0)(uuid@11.0.5)
       '@graasp/stylis-plugin-rtl':
         specifier: 2.2.0
         version: 2.2.0(stylis@4.3.6)
@@ -1828,8 +1828,8 @@ packages:
   '@fontsource-variable/nunito@5.1.1':
     resolution: {integrity: sha512-o4VVGDO/q2KaQp7aU6iKmKQ7sbalUOeA/D9nxY+o80ga/IV+7i+Yb/CpqNxAwjAWVhgdE2UiQlpsc38+j47ekw==}
 
-  '@graasp/sdk@5.13.0':
-    resolution: {integrity: sha512-m4rLz18l2v7bF9MUlx6ApjNrhIf+8/US/YveZtxoaLHQnE2OjhOuznPIuAlqeTxOS2hZK1X6DYX2ZcE7AOXq0A==}
+  '@graasp/sdk@5.13.1':
+    resolution: {integrity: sha512-7Md0vKCPyI3yaK/mf8wPddEwh3tMdWI+uZkEV+UxWgwHzu0TKeUEe0EnS+QnnQBff5/DRdwQnilJpsRLaHCW8A==}
     peerDependencies:
       date-fns: ^4
       uuid: ^9 || ^10 || ^11.0.0
@@ -8722,7 +8722,7 @@ snapshots:
 
   '@fontsource-variable/nunito@5.1.1': {}
 
-  '@graasp/sdk@5.13.0(date-fns@4.1.0)(uuid@11.0.5)':
+  '@graasp/sdk@5.13.1(date-fns@4.1.0)(uuid@11.0.5)':
     dependencies:
       '@faker-js/faker': 9.7.0
       date-fns: 4.1.0
diff --git a/src/modules/builder/components/input/MultiSelectTagChipInput.tsx b/src/modules/builder/components/input/MultiSelectTagChipInput.tsx
index f09fa4f43..6aed32c42 100644
--- a/src/modules/builder/components/input/MultiSelectTagChipInput.tsx
+++ b/src/modules/builder/components/input/MultiSelectTagChipInput.tsx
@@ -13,7 +13,7 @@ import {
   TextField,
 } from '@mui/material';
 
-import { DiscriminatedItem, TagCategory } from '@graasp/sdk';
+import { DiscriminatedItem, TagCategoryType } from '@graasp/sdk';
 
 import { NS } from '@/config/constants';
 import { hooks } from '@/config/queryClient';
@@ -27,7 +27,7 @@ import useTagsManager from '../item/publish/customizedTags/useTagsManager';
 
 type Props = {
   itemId: DiscriminatedItem['id'];
-  tagCategory: TagCategory;
+  tagCategory: TagCategoryType;
   helpertext?: string;
 };
 
diff --git a/src/modules/builder/components/item/publish/customizedTags/useTagsManager.tsx b/src/modules/builder/components/item/publish/customizedTags/useTagsManager.tsx
index 98e8018b5..7d16654bb 100644
--- a/src/modules/builder/components/item/publish/customizedTags/useTagsManager.tsx
+++ b/src/modules/builder/components/item/publish/customizedTags/useTagsManager.tsx
@@ -1,7 +1,7 @@
 import { useState } from 'react';
 import { useTranslation } from 'react-i18next';
 
-import { DiscriminatedItem, Tag, TagCategory } from '@graasp/sdk';
+import { DiscriminatedItem, Tag, TagCategoryType } from '@graasp/sdk';
 
 import groupBy from 'lodash.groupby';
 
@@ -26,7 +26,10 @@ type UseMultiSelectChipInput = {
   isSuccess: boolean;
   isError: boolean;
 
-  handleCurrentValueChanged: (newValue: string, category: TagCategory) => void;
+  handleCurrentValueChanged: (
+    newValue: string,
+    category: TagCategoryType,
+  ) => void;
   addValue: (tag: Pick<Tag, 'name' | 'category'>) => void;
   resetCurrentValue: () => void;
   deleteValue: (tagId: Tag['id']) => void;
@@ -91,7 +94,7 @@ export const useTagsManager = ({ itemId }: Props): UseMultiSelectChipInput => {
 
   const handleCurrentValueChanged = (
     newValue: string,
-    category: TagCategory,
+    category: TagCategoryType,
   ) => {
     validateData({ name: newValue, category });
     setCurrentValue(newValue);
diff --git a/src/query/api/search.ts b/src/query/api/search.ts
index ef64bd88e..d050c6cfe 100644
--- a/src/query/api/search.ts
+++ b/src/query/api/search.ts
@@ -1,4 +1,4 @@
-import { MeiliSearchResults, Tag, TagCategory } from '@graasp/sdk';
+import { MeiliSearchResults, Tag, TagCategoryType } from '@graasp/sdk';
 
 import { API_HOST } from '@/config/env.js';
 import { axiosClient as axios } from '@/query/api/axios.js';
@@ -19,7 +19,7 @@ export type MeiliSearchProps = {
   page?: number;
   elementsPerPage?: number;
   query?: string;
-  tags?: Record<TagCategory, Tag['name'][]>;
+  tags?: Record<TagCategoryType, Tag['name'][]>;
   isPublishedRoot?: boolean;
   langs?: string[];
 };
diff --git a/src/query/keys.ts b/src/query/keys.ts
index 921c0022a..2ac6baac9 100644
--- a/src/query/keys.ts
+++ b/src/query/keys.ts
@@ -5,7 +5,7 @@ import {
   ItemTypeUnion,
   Pagination,
   Tag,
-  TagCategory,
+  TagCategoryType,
   UUID,
   UnionOfConst,
 } from '@graasp/sdk';
@@ -146,7 +146,7 @@ export const itemKeys = {
 
   search: (args: {
     query?: string;
-    tags?: { [key in TagCategory]: Tag['name'][] };
+    tags?: { [key in TagCategoryType]: Tag['name'][] };
     isPublishedRoot?: boolean;
     limit?: number;
     offset?: number;
diff --git a/src/query/tag/api.ts b/src/query/tag/api.ts
index ffcc85a0e..3b52c9d9e 100644
--- a/src/query/tag/api.ts
+++ b/src/query/tag/api.ts
@@ -1,4 +1,4 @@
-import { Tag, TagCategory } from '@graasp/sdk';
+import { Tag, TagCategoryType } from '@graasp/sdk';
 
 import { API_HOST } from '@/config/env.js';
 import { axiosClient as axios } from '@/query/api/axios.js';
@@ -7,7 +7,7 @@ import { buildGetTagCountsRoute } from './routes.js';
 
 export const getTagCounts = async (args: {
   search?: string;
-  category?: TagCategory;
+  category?: TagCategoryType;
 }) => {
   return axios
     .get<
diff --git a/src/query/tag/hooks.ts b/src/query/tag/hooks.ts
index 327a786e8..9b2b37dd7 100644
--- a/src/query/tag/hooks.ts
+++ b/src/query/tag/hooks.ts
@@ -1,4 +1,4 @@
-import { TagCategory } from '@graasp/sdk';
+import { TagCategoryType } from '@graasp/sdk';
 
 import { useQuery } from '@tanstack/react-query';
 
@@ -15,7 +15,7 @@ export default (queryConfig: QueryClientConfig) => {
       category,
     }: {
       search?: string;
-      category?: TagCategory;
+      category?: TagCategoryType;
     }) => {
       return useQuery({
         queryKey: tagKeys.search({
diff --git a/src/query/tag/keys.ts b/src/query/tag/keys.ts
index 1e2dab03f..373af6ec4 100644
--- a/src/query/tag/keys.ts
+++ b/src/query/tag/keys.ts
@@ -1,5 +1,8 @@
-import { TagCategory } from '@graasp/sdk';
+import { TagCategoryType } from '@graasp/sdk';
 
 export const tagKeys = {
-  search: (args: { search?: string; category?: TagCategory }) => ['tags', args],
+  search: (args: { search?: string; category?: TagCategoryType }) => [
+    'tags',
+    args,
+  ],
 };
diff --git a/src/query/tag/routes.ts b/src/query/tag/routes.ts
index ae1a22733..c529de6e6 100644
--- a/src/query/tag/routes.ts
+++ b/src/query/tag/routes.ts
@@ -1,11 +1,11 @@
-import { TagCategory } from '@graasp/sdk';
+import { TagCategoryType } from '@graasp/sdk';
 
 export const buildGetTagCountsRoute = ({
   search,
   category,
 }: {
   search?: string;
-  category?: TagCategory;
+  category?: TagCategoryType;
 }) => {
   const searchParams = new URLSearchParams();
 


Reviews:
user: login: pyphilia
body: LGTM! 💄 
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T09:11:01Z

Review comments:
diff_hunk: @@ -19,7 +19,7 @@
     "@emotion/react": "11.14.0",
     "@emotion/styled": "11.14.0",
     "@fontsource-variable/nunito": "5.1.1",
-    "@graasp/sdk": "5.13.0",
+    "@graasp/sdk": "github:graasp/graasp-sdk#update-TagCategory-to-const",
path: package.json
user: login: pyphilia
body: to update
created_at: 2025-05-09T09:09:39Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,7 +65,7 @@ export const CustomizedTags = ({ item }: Props): JSX.Element => {
             </Typography>
             <MultiSelectTagChipInput
               itemId={item.id}
-              tagCategory={TagCategory.Discipline}
+              tagCategory="discipline"
path: src/modules/builder/components/item/publish/customizedTags/CustomizedTags.tsx
user: login: pyphilia
body: Use `TagCategory.Discipline` like the ones below?
created_at: 2025-05-09T09:10:48Z
author_association: CONTRIBUTOR

PR comments:
user: login: sonarqubecloud[bot]
created_at: 2025-05-09T10:14:38Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=graasp_graasp-account&pullRequest=993) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=graasp_graasp-account&pullRequest=993&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=graasp_graasp-account&pullRequest=993&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=graasp_graasp-account&pullRequest=993&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=graasp_graasp-account&pullRequest=993&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=graasp_graasp-account&pullRequest=993&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=graasp_graasp-account&pullRequest=993)


author_association: NONE