Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(admin): check clone with isAxiosError in CM ListView #20326

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

iamandrewluca
Copy link
Contributor

@iamandrewluca iamandrewluca commented May 17, 2024

Clone feature did not work in ListView, did some debugging, and for some reason, err instanceof AxiosError did not work when cloning entities. (probably related to multiple loaded axios instances)
Using the native axios util to check if is an Axios error worked.

Using this patch, meanwhile.

patches/@strapi+admin+4.24.2.patch

diff --git a/node_modules/@strapi/admin/dist/_chunks/index-KTSQuD27.mjs b/node_modules/@strapi/admin/dist/_chunks/index-KTSQuD27.mjs
index b8e77b7..ef64869 100644
--- a/node_modules/@strapi/admin/dist/_chunks/index-KTSQuD27.mjs
+++ b/node_modules/@strapi/admin/dist/_chunks/index-KTSQuD27.mjs
@@ -17825,7 +17825,7 @@ const ListViewPage = ({
         });
       }
     } catch (err) {
-      if (err instanceof AxiosError) {
+      if (isAxiosError(err)) {
         const { prohibitedFields } = err.response?.data.error.details;
         setClonedEntryId(id);
         setProhibitedCloningFields(prohibitedFields);
diff --git a/node_modules/@strapi/admin/dist/_chunks/index-hDD1JNph.js b/node_modules/@strapi/admin/dist/_chunks/index-hDD1JNph.js
index bf8d208..20d40e5 100644
--- a/node_modules/@strapi/admin/dist/_chunks/index-hDD1JNph.js
+++ b/node_modules/@strapi/admin/dist/_chunks/index-hDD1JNph.js
@@ -17886,7 +17886,7 @@ const ListViewPage = ({
         });
       }
     } catch (err) {
-      if (err instanceof axios.AxiosError) {
+      if (axios.isAxiosError(err)) {
         const { prohibitedFields } = err.response?.data.error.details;
         setClonedEntryId(id);
         setProhibitedCloningFields(prohibitedFields);

PS: It seems there are a lot of err instanceof AxiosError across the project.

Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
contributor-docs ❌ Failed (Inspect) May 17, 2024 11:57am

@iamandrewluca iamandrewluca changed the title fix(strapi/admin): check for AxiosError with isAxiosError in content-manager ListView fix(strapi/admin): check with isAxiosError in content-manager ListView May 17, 2024
@iamandrewluca iamandrewluca changed the title fix(strapi/admin): check with isAxiosError in content-manager ListView fix(strapi/admin): check clone with isAxiosError in CM ListView May 17, 2024
@iamandrewluca iamandrewluca changed the title fix(strapi/admin): check clone with isAxiosError in CM ListView fix(admin): check clone with isAxiosError in CM ListView May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant