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

SLB-202: De-duplicate Gatsby queries #126

Merged
merged 15 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/schema/src/operations/NotFoundPage.gql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ query NotFoundPage {
translations {
id
locale
path
...Page
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/src/operations/ViewPage.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query ViewPage($id: ID!, $rid: ID, $locale: String!) {
page(id: $id, rid: $rid, locale: $locale) {
page: viewPage(id: $id, rid: $rid, locale: $locale) {
...Page
}
}
14 changes: 7 additions & 7 deletions packages/schema/src/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ type ContentHubResult @default @value(json: "{\"total\": 0, \"items\": []}") {

type WebsiteSettings
@entity(type: "config_pages", bundle: "website_settings", access: false) {
homePage: DrupalPage
@resolveEntityReference(field: "field_home_page")
@seek(pos: 0)
notFoundPage: DrupalPage
homePage: Page @resolveEntityReference(field: "field_home_page") @seek(pos: 0)
notFoundPage: Page
@resolveEntityReference(field: "field_404_page")
@seek(pos: 0)
}
Expand Down Expand Up @@ -67,8 +65,9 @@ type FooterNavigation implements Navigation @menu(menu_id: "footer") {
items: [NavigationItem]! @lang @resolveMenuItems
}

interface Page implements ContentHubResultItem {
interface Page implements ContentHubResultItem @value(json: "\"page\"") {
Leksat marked this conversation as resolved.
Show resolved Hide resolved
id: ID!
translations: [Page]
locale: Locale!
path: Url!
title: String!
Expand All @@ -81,6 +80,7 @@ interface Page implements ContentHubResultItem {
type DecapPage implements ContentHubResultItem & Page
@sourceFrom(fn: "getPages") {
id: ID!
translations: [Page]
locale: Locale!
path: Url!
title: String!
Expand All @@ -98,8 +98,8 @@ type DrupalPage implements ContentHubResultItem & Page
@type(id: "page") {
id: ID! @resolveEntityUuid
locale: Locale! @resolveEntityLanguage
translations: [DrupalPage] @resolveEntityTranslations
path: Url! @resolveEntityPath @isPath
translations: [Page] @resolveEntityTranslations
title: String! @resolveProperty(path: "title.value")
teaserImage: MediaImage
@resolveEditorBlocks(path: "body.value")
Expand Down Expand Up @@ -173,7 +173,7 @@ type Query {

allPages: [Page] @gatsbyNodes(type: "Page")
websiteSettings: WebsiteSettings
page(id: ID!, rid: ID, locale: String!): Page
viewPage(id: ID!, rid: ID, locale: String!): Page
@fetchEntity(type: "node", id: "$id", rid: "$rid", language: "$locale")
@gatsbyNode(type: "Page", id: "$id")

Expand Down