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: allow self referencing relationships when adding new collections to config #9360

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

JarrodMFlesch
Copy link
Contributor

What?

Unable to add collections to the config dynamically if they reference their own collection in a relationship field.

This was discovered while working on the folder view feature which dynamically adds collections to your config if it is enabled per collection.

Why?

When sanitizeCollection runs, it takes the current config. If you are sanitizing a collection before adding it to the config, that collection cannot have any self referencing relationship fields on it otherwise it fails the validRelationships check.

How?

Using a reducer we now initialize the validRelationships variable with the incoming collection slug.

@JarrodMFlesch JarrodMFlesch merged commit 4030e21 into main Nov 19, 2024
57 checks passed
@JarrodMFlesch JarrodMFlesch deleted the fix/sanitize-valid-relationships branch November 19, 2024 21:22
Copy link

🚀 This is included in version v3.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant