-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
chore(content-releases): releases migration to v5 #20259
base: v5/main
Are you sure you want to change the base?
Conversation
* chore: migrate bulkDelete to v5 * chore: change findLocales type to accept strings array * fix: docs prettier styles * chore: remove console.log
…into v5/bulk-publish-unpublish
packages/core/content-releases/server/src/controllers/release.ts
Outdated
Show resolved
Hide resolved
This comment was marked as spam.
This comment was marked as spam.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/core/content-releases/server/src/middlewares/documents.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall approach lgtm ! :) only added minor comments
…ny lifecycle async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some strange decisions in the FE i think we need to discuss.
@@ -35,7 +35,7 @@ class FetchError extends Error { | |||
public name: string; | |||
public message: string; | |||
public response?: ErrorResponse; | |||
public code?: number; | |||
public code?: number | string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when is code a string? 🤔
'Release', | ||
'ReleaseAction', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cross-domain pollution with 0 documentation? Why are you doing this here and what other ways did you consider doing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that changes to documents could cause stale release data. For example, if you have an invalid entry that causes a release to have a "Blocked" status, and then you go to the Edit View and update the entry to fit the validation rules, this changes the release status to "Ready". This is the scenario I want to address here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should be doing it this way in that case i think? https://redux-toolkit.js.org/rtk-query/api/created-api/code-splitting#enhanceendpoints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I didn't explain the first question 😅 I'm doing that I think, for example I invalidate the releases tags here on the update document.
Adding the types here is to avoid a Typescript error that not allowed me to invalidate the releases tags because they are not known. Here is a discussion about this on the RTK's repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're invalidating it in the wrong place, because thats the endpoint definition in the domain of the content-manager, instead your enhanceEndpoints
object on the CR service should look like this:
.enhanceEndpoints({
addTagTypes: ['Release', 'ReleaseAction', 'EntriesInRelease'],
endpoints: {
updateDocument: {
invalidatesTags: [
{ type: 'Release', id: 'LIST' },
{ type: 'ReleaseAction', id: 'LIST' },
],
},
deleteDocument: {
invalidatesTags: [
{ type: 'Release', id: 'LIST' },
{ type: 'ReleaseAction', id: 'LIST' },
],
},
deleteManyDocuments: {
invalidatesTags: [
{ type: 'Release', id: 'LIST' },
{ type: 'ReleaseAction', id: 'LIST' },
],
},
discardDocument: {
invalidatesTags: [
{ type: 'Release', id: 'LIST' },
{ type: 'ReleaseAction', id: 'LIST' },
],
},
},
})
where you add the invalidate tags from this side, keeping the release logic locked away. This is the way i'd expect plugin authors to have their data invalidated when a document is published, for example.
"@strapi/design-system": "2.0.0-beta.6", | ||
"@strapi/icons": "2.0.0-beta.6", | ||
"@strapi/types": "workspace:*", | ||
"@strapi/utils": "5.0.0-beta.9", | ||
"axios": "1.6.8", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how come you need axios? we've moved the FE to use native fetch
{ | ||
collectionType: schema?.kind ?? '', | ||
model: schema?.uid ?? '', | ||
}, | ||
{ | ||
skip: !schema, | ||
skip: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add this as a comment, it's not clear to people
import { CMReleasesContainer } from './components/CMReleasesContainer'; | ||
import { ReleaseActionModalForm } from './components/ReleaseActionModal'; | ||
import { Panel as ReleasesPanel } from './components/ReleasesPanel'; | ||
// import { addColumnToTableHook } from './components/ReleaseListCell'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be here? did you forget about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for the "Releases" column in the list view, is not implemented yet and I would like to do it in an upcoming PR. I left the code commented here because I think it should not change too much at this file.
} from '@strapi/design-system'; | ||
import { Cursor } from '@strapi/icons'; | ||
import { EmptyDocuments } from '@strapi/icons/symbols'; | ||
import { isAxiosError } from 'axios'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the base query uses fetch not axios so your calls to this won't work as expected.
What does it do?
Migrates and apply new changes on the Content Releases plugin for v5.
Work to do