Have custom actions changed in v22? #3796
Replies: 5 comments 5 replies
-
I managed to get my action working again by referring to this: Hopefully the documentation gets updated soon. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately this still seems to be an issue in the new version (3.0.0-rc.0) |
Beta Was this translation helpful? Give feedback.
-
Hi everyone. I've asked the v3 team whether the removal of document actions from the // sanity.config.ts
import { defineConfig, definePlugin } from 'sanity'
import { deskTool } from 'sanity/desk'
import { schemaTypes } from './schemas'
import { DocumentActionComponent, DocumentActionDescription, DocumentActionProps } from 'sanity'
const createWrappedPublishAction = (publishAction: DocumentActionComponent) => {
const wrappedPublish = (props: DocumentActionProps): DocumentActionDescription | null => {
const originalPublishDescription = publishAction(props);
return (
originalPublishDescription && {
...originalPublishDescription,
label: 'Publish 2.0',
}
)
}
return wrappedPublish;
}
const myPlugin = definePlugin({
name: 'change-publish',
document: {
actions: (prev) => {
return prev.map((action) => {
console.log(action)
if (action.action === 'publish') {
return createWrappedPublishAction(action);
}
return action;
})
}
},
});
export default defineConfig({
name: 'default',
title: 'Playground v3',
projectId: '<YOUR_PROJECT_ID>',
dataset: 'production',
plugins: [
deskTool(),
myPlugin(),
],
schema: {
types: schemaTypes,
},
}) If this is not adequate for each of your use cases, please let us know so we can bring it to the v3 team. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Without a simple way to remove actions from things like singletons it's hard to make a robust easy to use Content Editor for users... |
Beta Was this translation helpful? Give feedback.
-
Still no clear explanation how to do simple things in V3, that worked perfectly with __experimental_actions: |
Beta Was this translation helpful? Give feedback.
-
In the documentation for Actions & Buttons
actions: (prev) => ...
would allow us to intercept the default actions and swap a custom one out based on its name.prev
now just returns an empty array[]
so this approach no longer works. How do we do it instead? Or is this just broken?Also
PublishAction(props)
has as the documentation suggests has changed. It is no longer exported fromsanity
. What is the replacement?Beta Was this translation helpful? Give feedback.
All reactions