Sanity: Improve unpublish/delete error when referenced somewhere

Created on 23 Apr 2020  路  4Comments  路  Source: sanity-io/sanity

Is your feature request related to a problem? Please describe.
Unpublish and delete a doc can fail with a vague error about being possibly linked somewhere.

Describe the solution you'd like
We should be able to unpublish or delete anything (with a warning/confirmation) and the other linked item should have a graceful fallback if it is deleted or unpublished. This is how Contentful handles it. The reason is a user may need to remove a page from the live site and they are basically stuck at that point if they can't unpublish or delete it.

Also, one basic rule of User Interfaces is you never leave your user hanging with nowhere to go. The message is not user friendly. At a minimum the message should at least tell you exactly what is linking to it in a friendly way and easily allow you to discover those associations and remove them to resolve the problem.

This is a real problem for me right now because I am building a workflow where documents are approved (+ published automatically) or disapproved (+ unpublished automatically) and basically a user is going to disapprove a doc and run into this error because it might be already used on the site and there is no good way around it for them.

Describe alternatives you've considered
Using a published at field is a hack around the system and is not intuitive to the published/draft model. If I set a published at field to the future for instance to get around this issue it will show the doc was published message fly in which is confusion, it was disapproved but published?

Additional context
image

Most helpful comment

"Weak" references might help here.
https://www.sanity.io/docs/reference-type#example-weak-reference-f45f659e7b28

All 4 comments

Can we at least set the publishedAt field to null in the meantime? I tried doing that and it said invalid value for dateTime. Now I need to filter all future dates from rendering in all my page datas? 馃槩

"Weak" references might help here.
https://www.sanity.io/docs/reference-type#example-weak-reference-f45f659e7b28

Thanks @tkdave I'll look into that! Is there any drawback to making everything a weak reference?

Even with using a weak reference I still feel the UI could use a better way for a regular user to resolve this and not being stuck.

Hi Zane 鈥撀爐hat dialogue should link to the documents doing the referencing so the user can go remediate it. Marking the references as weak will allow deletion, but will leave you with dangling references.

We'll look into why this dialogue isn't more helpful. Thank you for bringing it to our attention.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nettum picture nettum  路  3Comments

bjoerge picture bjoerge  路  3Comments

mickeyreiss picture mickeyreiss  路  5Comments

davesag picture davesag  路  6Comments

camjc picture camjc  路  4Comments