Repository navigation
Conversation
…tion path (Thinkmill#340) Signed-off-by: Saik2789 <220439327+Saik2789@users.noreply.github.com>
🦋 Changeset detectedLatest commit: fb4407a The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #340
@algora-pbc /claim #340
Summary
Collection entry paths were previously static except for the single wildcard segment derived from
slugField. Projects requiring paths partitioned by schema fields (such as locales or publication dates) could not configure dynamic collection paths while maintaining static directory discovery for GitHub and local filesystem storage.Changes
config.tsx,form/api.tsx): ExtendedCollection['path']withCollectionPathsupporting dynamic function callbacks (e.g.({ locale }) => \content/blog/${locale}/`) as well as{field}segment placeholders (content/blog/{locale}/`).path-utils.ts): AddedcreatePathProxyandparseCollectionPathto resolve function callbacks and placeholder strings into deterministic segment patterns (slugPattern,prefix,glob,suffix). Added schema validation ensuring placeholders map to valid form fields.utils.ts,validateText.tsx,errors.ts,slugs.tsx): UpdatedgetSlugFromStateto compose composite slugs from field values (string,number,boolean, andDateinstances), and updated slug validation to enforce composite slug uniqueness while allowing identical slug segments across distinct partitions (e.g.en/postvsfr/post).reader/generic.ts,utils.ts): UpdatedgetEntriesInCollectionWithTreeKeyandcollectionReader'slistandreadmethods to traverse matching segment depths, preventing wrong-depth matches and extracting the primary slug segment for form parsing.CollectionPage.tsx,ItemPage.tsx,create-item.tsx,entry-clipboard.ts,useHasChanged.ts,useItemData.ts): ThreadedpathInfothrough preview props, clipboard deserialization, change detection, and entry creation/renaming.path-utils.test.ts,.changeset/configurable-collection-path.md): Added comprehensive test suite with 22 tests covering path parsing, function evaluation, date fields, error boundaries, tree listing, and reader integration.Testing
pnpm exec vitest run packages/keystatic/src/app/path-utils.test.tsOutput:
pnpm testOutput:
Both passed cleanly with 0 errors and 0 warnings.
Payout Details