Validate slug uniqueness also in draft charts #4470
Labels
admin
Issues that need to be solved in the grapher admin (mostly)
feature
priority 3 - nice to have
soonish and small
Do it some time soon like next cooldown
viz
Core problem
Draft charts don't get their slug validated to ensure it is unique.
Context
When publishing a chart, we need to ensure that its
slug
is unique, or Grapher will complain when attempting to publish the chart (see image below)However, if we save the chart as a draft, Grapher won't complain. This may seem irrelevant, but it can cause issues when working with staging servers & chart diff.
When working on a data project with Saloni, we have a workflow like:
Considering this, if we use a slug that's already in use, chart-diff will show the error:
While this is caught in chart-diff (and shouldn't go unnoticed), it would be nicer if we could catch it earlier. E.g. when the author saves the draft in Admin.
Proposed solution
Apply the same validation logic to draft charts. This means running the same checks when clicking "Save draft" than when clicking on "Publish" or "Update chart".
The text was updated successfully, but these errors were encountered: