Skip to content

Commit 4904ac1

Browse files
committed
fix: updated logic for removing the url_alias field from the edit form
1 parent b69abf6 commit 4904ac1

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.changeset/stupid-rockets-ring.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"strapi-plugin-webtools": patch
3+
---
4+
5+
fix: updated logic for removing the url_alias field from the edit form

packages/core/admin/components/EditView/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ const EditView = () => {
3838
useEffect(() => {
3939
const label = Array.from(document.querySelectorAll('label')).find((l) => l.textContent.startsWith('url_alias'));
4040
if (label) {
41-
label.closest('div').remove();
41+
let parentDiv = label.closest('div');
42+
for (let i = 0; i < 2; i++) {
43+
if (parentDiv) {
44+
// @ts-expect-error
45+
parentDiv = parentDiv.parentElement;
46+
}
47+
}
48+
if (parentDiv) {
49+
parentDiv.remove();
50+
}
4251
}
4352
}, []);
4453

0 commit comments

Comments
 (0)