Skip to content

Unknown fragment linkPropertyData #93

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
ethan-schofer opened this issue Mar 3, 2025 · 2 comments
Open

Unknown fragment linkPropertyData #93

ethan-schofer opened this issue Mar 3, 2025 · 2 comments

Comments

@ethan-schofer
Copy link

Hi

Trying to use the Optimizely SaaS starter site. In the CMS, I have page type with a property that is a LinkItem. When I generate code, it generates a graphql query for this:

fragment linkPropertyData on linkProperty {
url { ...LinkData }
title
text
target
}

Here is the page that references this fragment:

fragment BasicPageData on BasicPage {
PageBanner { ...BlockData }
PageTitle
BodyText { json, html }
BodyTextCta { ...linkPropertyData }
BodyTextCtaAccessibilityText
MainContent { ...BlockData }
}

But when run 'yarn compile' I get an error that it can't find this fragment:

[FAILED] GraphQL Document Validation failed with 1 errors;
[FAILED] Error 0: Unknown fragment "linkPropertyData".
[FAILED] at C:/Projects/opti-saas-starter/src/components/cms/page/BasicPage/BasicPage.page.graphql:5:20

Does this have to do with the LinkItem itself? Do I need to explicitly import that fragment? Would that get lost the next time I compiled?

Thanks

Ethan

@ethan-schofer
Copy link
Author

It feels like this should be part of optimizely-graph functions?

@remkoj
Copy link
Collaborator

remkoj commented Apr 18, 2025

Hi @ethan-schofer: The Graph-Functions package removes all fragments that are targeting a non-existing types. This allows fragments to be present in a project that are both not used and targeting a non-existing type. The downside is that instead of the expected "Type not present in Graph", you'll see a "Fragment not found" error. Can you verify that the type you're targeting with this fragment is actually present in Graph?

That'll help to pinpoint the actual cause of the error.

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

No branches or pull requests

2 participants