Skip to content

docs: use computed property value in docs #12358

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

femioladipo
Copy link
Contributor

What?

Refactor storage adapter collections config in the examples to use computed property values via .slug rather than raw string literals.

Why?

Using computed values (e.g., [Media.slug]) ensures the adapter key stays in sync with the actual collection slug, avoiding silent mismatches due to typos or future refactors. While such mismatches shouldn’t happen in a well-managed codebase, “Anything that can happen will happen.” – Murphy’s Law.

This approach improves reliability and clarity. The original example mixed media (default collection key) with a literal string 'media-with-prefix', which could be confusing—especially since these examples are in documentation and readers cannot inspect the underlying collections directly to understand these are representing their respective slugs.

How?

Replaced hard-coded keys in the collections config with computed property values:

collections: {
  [Media.slug]: true,
  [MediaWithPrefix.slug]: { prefix },
}

This ensures both configuration keys are explicitly tied to their respective collections.

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

Successfully merging this pull request may close these issues.

1 participant