Skip to content

Universal graphql client #553

@GauBen

Description

@GauBen

The goal of the spike is to provide developers a graphql query client that can run on both the server and the client

For instance, when running in a server-rendered island:

// Foo.client.tsx
export default function Foo() {
  // This will run on the server and on every re-render of the component
  const { data } = useGQLQuery({
    query: `query { ... }`
  })

  return <div>{data}</div>;
}

// default.server.tsx
jahiaComponent({}, () => {
  return <Island component={Foo} />; // Rendered on the server, hydrated on the client
})
  • GraphQL queries should be typed
  • The initial value should be serialized in the server response, to skip the initial query on the client

Outcomes

  • POC
  • Tickets to consolidate if accepted

Notes

I'm currently investigating this in Luxe

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions