-
Notifications
You must be signed in to change notification settings - Fork 467
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
POC: Spike GraphQL query management and merging strategy (DONT MERGE) #30814
POC: Spike GraphQL query management and merging strategy (DONT MERGE) #30814
Conversation
contentQueries: string; | ||
}) => ` | ||
fragment DotCMSPage on DotPage { | ||
_map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think we need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, we can define the props we need.
viewAs { | ||
visitor { | ||
persona { | ||
name | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not
page: { | ||
url: params?.slug?.join('/'), | ||
language: searchParams?.language_id, | ||
mode: 'EDIT_MODE', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to control this, should be optional for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
"use client"; | ||
'use client'; | ||
|
||
import WebPageContent from "./content-types/webPageContent"; | ||
import Banner from "./content-types/banner"; | ||
import Blog from "./content-types/blog"; | ||
import Activity from "./content-types/activity"; | ||
import CallToAction from "./content-types/callToAction"; | ||
import CalendarEvent from "./content-types/calendarEvent"; | ||
import Product from "./content-types/product"; | ||
import ImageComponent from "./content-types/image"; | ||
import WebPageContent from './content-types/webPageContent'; | ||
import Banner from './content-types/banner'; | ||
import Blog from './content-types/blog'; | ||
import Activity from './content-types/activity'; | ||
import CallToAction from './content-types/callToAction'; | ||
import CalendarEvent from './content-types/calendarEvent'; | ||
import Product from './content-types/product'; | ||
import ImageComponent from './content-types/image'; | ||
|
||
import Header from "./layout/header/header"; | ||
import Footer from "./layout/footer/footer"; | ||
import Navigation from "./layout/navigation"; | ||
import { usePathname, useRouter } from "next/navigation"; | ||
import { DotcmsLayout } from "@dotcms/react"; | ||
import { withExperiments } from "@dotcms/experiments"; | ||
import { CustomNoComponent } from "./content-types/empty"; | ||
import Header from './layout/header/header'; | ||
import Footer from './layout/footer/footer'; | ||
import Navigation from './layout/navigation'; | ||
import { usePathname, useRouter } from 'next/navigation'; | ||
import { DotcmsLayout } from '@dotcms/react'; | ||
import { withExperiments } from '@dotcms/experiments'; | ||
import { CustomNoComponent } from './content-types/empty'; | ||
|
||
import { usePageAsset } from "../hooks/usePageAsset"; | ||
import NotFound from "@/app/not-found"; | ||
import { usePageAsset } from '../hooks/usePageAsset'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this keep happening?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My global prettier is configured for single quotes and maybe someone else in the team uses double quotes in their IDE, the examples does not have prettier
Quality Gate passedIssues Measures |
Summary
This POC makes use of GraphQL Fragments in order to merge queries. Also makes use of the proposed API that we selected in the planning stage.
This way the developer should only write a
Fragment
to extend the Page API response and also can write as much queries as they want inside thecontent
object.In this case all limitations, errors, query depth, cache handling and implications will be inherited naturally from how the GraphQL API works, since we are using a native way of merge queries and should not require any extra work from our side apart from exposing a simple way of using dotCMS API with GQL Queries and adapt our current architecture to make it editable inside UVE (which changes can be seen in this PR in a simple version of how it should be).
Content Editing with this POC on UVE
Screen.Recording.2024-11-29.at.3.08.43.PM-1.mov
This POC is just a proof of how this can be achieved and not a final design of how this will work or the architecture of it, we still have to make some work to make this as clean, easy and reuse as much code as we can (building the queries inside content, at least the Lucene Query, can be done with an existing API).