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

reference field-custom-filter-api (PR from TinaCMS) #2229

Merged
merged 20 commits into from
Oct 3, 2024

Conversation

tina-cloud-app[bot]
Copy link
Contributor

@tina-cloud-app tina-cloud-app bot commented Sep 19, 2024

New API for reference field introduced

Add documentation for custom filter in reference field

Co-authored-by: Ben Neoh <[email protected]>
Copy link

vercel bot commented Sep 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tina-io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2024 5:17am

@Ben0189 Ben0189 marked this pull request as ready for review September 19, 2024 04:40
@Ben0189 Ben0189 requested a review from a team as a code owner September 19, 2024 04:40
@Ben0189
Copy link
Member

Ben0189 commented Sep 19, 2024

⚠️This PR should not be merge until the feature in TinaCMS is deployed tinacms/tinacms#4780

content/docs/reference/types/reference.mdx Outdated Show resolved Hide resolved
content/docs/reference/types/reference.mdx Outdated Show resolved Hide resolved
content/docs/reference/types/reference.mdx Outdated Show resolved Hide resolved
content/docs/reference/types/reference.mdx Show resolved Hide resolved
content/docs/reference/types/reference.mdx Outdated Show resolved Hide resolved
content/docs/reference/types/reference.mdx Show resolved Hide resolved
content/docs/reference/types/reference.mdx Outdated Show resolved Hide resolved
tina-cloud-app bot and others added 3 commits September 19, 2024 23:14
Co-authored-by: Ben Neoh <[email protected]>
@isaaclombardssw
Copy link
Contributor

Still waiting on the feature for this one @Ben0189

Co-authored-by: Ben Neoh <[email protected]>
content/docs/reference/types/reference.mdx Outdated Show resolved Hide resolved
content/docs/reference/types/reference.mdx Outdated Show resolved Hide resolved
content/docs/reference/types/reference.mdx Outdated Show resolved Hide resolved
Copy link
Contributor

@isaaclombardssw isaaclombardssw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great update, good feature.

@JackDevAU
Copy link
Member

Might also be worth mentioning the following,

Inline functions won't work as the properties aren't called. e.g. the below code won't work and will return all authors (collection):

collectionFilter: {
          author: {
            date: () => Date.now().toString(),
          },
        },

Instead we would need to add this function outside as it will only be run on build (and initialisation of the tinacms panel)

const filterByAuthorDate = () => Date.now().toString(),

const postSchema = {
...,
collectionFilter: {
          author: {
            date: filterByAuthorDate(),
          },
        },
        }

Co-authored-by: Ben Neoh <[email protected]>
Copy link
Member

@JackDevAU JackDevAU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦙

@Ben0189
Copy link
Member

Ben0189 commented Oct 3, 2024

This PR is ready to merge , the feature has merge into main

@Ben0189 Ben0189 merged commit c48095e into main Oct 3, 2024
4 checks passed
@Ben0189 Ben0189 deleted the tina/reference-field-custom-filter-api branch October 3, 2024 06:44
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.

3 participants