sanity-io / document-internationalization

Create unique translations of a document based on its language, joined by a shared reference document
MIT License
129 stars 39 forks source link

Prevent duplicate translations from being created when clicking “+ {language}” multiple times #158

Open sambeca opened 8 months ago

sambeca commented 8 months ago

Hi there. Thanks for sharing this plugin, it has been a great addition to our Sanity setup.

I have encountered an issue where a user can accidentally create duplicate translations of the same document from the “Translations” menu by clicking the same “+ {language}” button multiple times before the translated document has been created.

This can be reproduced in the following steps:

  1. Create a base Sanity project with a single document type, e.g. page
  2. Install the plugin, and configure Sanity to translate the document as per the plugin instructions.
  3. Create a document in one language
  4. Create a document translation via the “+ {language}” button in the “Translations” menu, and then click the same button again immediately after.
  5. For each click until the first translated document is returned, a duplicate document will be created.

See video for demonstration.

https://github.com/sanity-io/document-internationalization/assets/42866396/9fc87a26-435b-4341-8731-7bea5e0fb309

It would be helpful to have a solution where when adding a translation, the “+ {language}” button is disabled after the first click until the translated document is created.

LouisJackson commented 8 months ago

Noticed the same issue on my project! ☝️

annabushsoftware commented 5 days ago

+1, would love a fix or workaround for this