Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-heads-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"strapi-plugin-webtools": minor
---

fix: make the url_alias field invisible by setting the strapi peer dep to 5.42.1
26 changes: 1 addition & 25 deletions packages/core/admin/components/WebtoolsPanel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React from 'react';
import { useQuery } from 'react-query';
import type { PanelComponent } from '@strapi/content-manager/strapi-admin';
import {
Expand Down Expand Up @@ -36,30 +36,6 @@ const WebtoolsPanel: PanelComponent = () => {
const locale = urlParams.get('plugins[i18n][locale]');
const aliases = useQuery(`aliases-${model}-${id}-${locale}`, async () => get<UrlAliasEntity[]>(`/webtools/url-alias/findFrom?model=${model}&documentId=${id}&locale=${locale}`), { enabled: false });

/**
* Ideally the url_alias field would be hidden, but doing so will cause an issue.
* The issue can be prevented by setting the field to visible. To make sure the user
* doesn't see the url_alias field, we just remove it from the dom.
*
* @see https://github.com/strapi/strapi/issues/23039
* @see https://github.com/strapi/strapi/issues/22975
*/
useEffect(() => {
const label = Array.from(document.querySelectorAll('label')).find((l) => l.textContent.startsWith('url_alias'));
if (label) {
let parentDiv = label.closest('div');
for (let i = 0; i < 2; i++) {
if (parentDiv) {
// @ts-expect-error
parentDiv = parentDiv.parentElement;
}
}
if (parentDiv) {
parentDiv.remove();
}
}
}, []);

// Early return if the user has no permissions to view the sidebar.
if (!canSidebar) return null;

Expand Down
12 changes: 6 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,24 @@
"eslint:fix": "eslint --fix './**/*.{js,jsx,ts,tsx}'"
},
"peerDependencies": {
"@strapi/admin": "^5.0.0",
"@strapi/admin": "^5.42.1",
"@strapi/design-system": "^2.0.0",
"@strapi/icons": "^2.0.0",
"@strapi/strapi": "^5.0.0",
"@strapi/utils": "^5.0.0",
"@strapi/strapi": "^5.42.1",
"@strapi/utils": "^5.42.1",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0",
"react-router-dom": "^6.0.0",
"styled-components": "^6.0.0"
},
"devDependencies": {
"@strapi/admin": "^5.0.0",
"@strapi/admin": "5.42.1",
"@strapi/design-system": "^2.0.0",
"@strapi/icons": "^2.0.0",
"@strapi/pack-up": "^5.0.0",
"@strapi/sdk-plugin": "^5.0.0",
"@strapi/strapi": "^5.0.0",
"@strapi/utils": "^5.0.0",
"@strapi/strapi": "5.42.1",
"@strapi/utils": "5.42.1",
"@types/koa": "^2.15.0",
"@types/lodash": "^4",
"@types/qs": "^6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ describe('Query layer decorator', () => {
populate: ['url_alias'],
});

console.log(category);
expect(category).toHaveProperty('url_alias[0].url_path', '/category/a-category');

const updatedCategory = await strapi.documents('api::category.category').update({
Expand Down
9 changes: 1 addition & 8 deletions packages/core/server/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => {
private: false,
configurable: false,
editable: false,
/**
* Ideally this field would be hidden, but doing so will cause an issue.
* The issue can be prevented by setting the field to visible.
*
* @see https://github.com/strapi/strapi/issues/23039
* @see https://github.com/strapi/strapi/issues/22975
*/
visible: true,
visible: false,
default: null,
type: 'relation',
relation: 'oneToMany',
Expand Down
6 changes: 3 additions & 3 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"sitemap": "strapi-sitemap"
},
"dependencies": {
"@strapi/plugin-cloud": "^5.42.1",
"@strapi/plugin-users-permissions": "^5.42.1",
"@strapi/strapi": "^5.42.1",
"@strapi/plugin-cloud": "5.42.1",
"@strapi/plugin-users-permissions": "5.42.1",
"@strapi/strapi": "5.42.1",
"better-sqlite3": "11.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down
12 changes: 6 additions & 6 deletions playground/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3949,7 +3949,7 @@ __metadata:
languageName: node
linkType: hard

"@strapi/plugin-cloud@npm:^5.42.1":
"@strapi/plugin-cloud@npm:5.42.1":
version: 5.42.1
resolution: "@strapi/plugin-cloud@npm:5.42.1"
dependencies:
Expand All @@ -3967,7 +3967,7 @@ __metadata:
languageName: node
linkType: hard

"@strapi/plugin-users-permissions@npm:^5.42.1":
"@strapi/plugin-users-permissions@npm:5.42.1":
version: 5.42.1
resolution: "@strapi/plugin-users-permissions@npm:5.42.1"
dependencies:
Expand Down Expand Up @@ -4047,7 +4047,7 @@ __metadata:
languageName: node
linkType: hard

"@strapi/strapi@npm:^5.42.1":
"@strapi/strapi@npm:5.42.1":
version: 5.42.1
resolution: "@strapi/strapi@npm:5.42.1"
dependencies:
Expand Down Expand Up @@ -12014,9 +12014,9 @@ __metadata:
version: 0.0.0-use.local
resolution: "playground-5@workspace:."
dependencies:
"@strapi/plugin-cloud": "npm:^5.42.1"
"@strapi/plugin-users-permissions": "npm:^5.42.1"
"@strapi/strapi": "npm:^5.42.1"
"@strapi/plugin-cloud": "npm:5.42.1"
"@strapi/plugin-users-permissions": "npm:5.42.1"
"@strapi/strapi": "npm:5.42.1"
"@types/node": "npm:^20"
"@types/pg": "npm:^8"
"@types/react": "npm:^18"
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7991,7 +7991,7 @@ __metadata:
languageName: node
linkType: hard

"@strapi/admin@npm:5.42.1, @strapi/admin@npm:^5.0.0":
"@strapi/admin@npm:5.42.1":
version: 5.42.1
resolution: "@strapi/admin@npm:5.42.1"
dependencies:
Expand Down Expand Up @@ -8583,7 +8583,7 @@ __metadata:
languageName: node
linkType: hard

"@strapi/strapi@npm:^5.0.0":
"@strapi/strapi@npm:5.42.1, @strapi/strapi@npm:^5.0.0":
version: 5.42.1
resolution: "@strapi/strapi@npm:5.42.1"
dependencies:
Expand Down Expand Up @@ -28203,13 +28203,13 @@ __metadata:
version: 0.0.0-use.local
resolution: "strapi-plugin-webtools@workspace:packages/core"
dependencies:
"@strapi/admin": "npm:^5.0.0"
"@strapi/admin": "npm:5.42.1"
"@strapi/design-system": "npm:^2.0.0"
"@strapi/icons": "npm:^2.0.0"
"@strapi/pack-up": "npm:^5.0.0"
"@strapi/sdk-plugin": "npm:^5.0.0"
"@strapi/strapi": "npm:^5.0.0"
"@strapi/utils": "npm:^5.0.0"
"@strapi/strapi": "npm:5.42.1"
"@strapi/utils": "npm:5.42.1"
"@types/koa": "npm:^2.15.0"
"@types/lodash": "npm:^4"
"@types/qs": "npm:^6"
Expand All @@ -28228,11 +28228,11 @@ __metadata:
yalc: "npm:^1.0.0-pre.53"
yup: "npm:^0.32.9"
peerDependencies:
"@strapi/admin": ^5.0.0
"@strapi/admin": ^5.42.1
"@strapi/design-system": ^2.0.0
"@strapi/icons": ^2.0.0
"@strapi/strapi": ^5.0.0
"@strapi/utils": ^5.0.0
"@strapi/strapi": ^5.42.1
"@strapi/utils": ^5.42.1
react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0
react-router-dom: ^6.0.0
Expand Down
Loading