Skip to content
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

Fix the failing auto-creation of default languages in translation field setup #22409

Merged
merged 4 commits into from May 8, 2024

Conversation

hanneskuettner
Copy link
Contributor

Scope

When creating a new translation field and the selected languages collection does not exist the app will create that collection and populate it with some default languages. There is however the edge case that surfaced where the app will try to create items in the non existing collection default collection (languages) if the user selects a custom languages collection and does not have the default collection in the data base. This is caused by items not properly resetting in the fieldDetailsStore.

To reproduce:

  • Make sure you start without the languages collection in your DB
  • Create a custom languages collection that is not called languages
  • Add a Translation field to an example collection (through the advanced creation flow)
  • Select your custom languages collection
  • Create the field and observe an error (also see that the app tries to call /items/languages in the network panel)

What's changed:

  • If item updates are provided do not merge them with the existing state but rather overwrite them. As far as I can tell the state.items is only utilized in the translations.ts alterations of the field detail store.

Potential Risks / Drawbacks

None

Review Notes / Questions

None


Fixes #20510

Copy link

changeset-bot bot commented May 7, 2024

🦋 Changeset detected

Latest commit: a562dd9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@directus/app Patch
@directus/api Patch
directus Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@paescuj paescuj self-assigned this May 7, 2024
paescuj

This comment was marked as resolved.

@hanneskuettner

This comment was marked as resolved.

@hanneskuettner hanneskuettner merged commit fd4821d into main May 8, 2024
4 checks passed
@hanneskuettner hanneskuettner deleted the fix-20510-translation-items branch May 8, 2024 10:00
@github-actions github-actions bot added this to the Next Release milestone May 8, 2024
paescuj added a commit that referenced this pull request May 8, 2024
…ld setup (#22409)

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Auto-create of languages collection will always result in 500 response
2 participants