Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pmelab committed Nov 24, 2023
1 parent 81a6d4f commit 02bcd82
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions apps/website/gatsby-browser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import './styles.css';

import { drupalOperator, registerOperator } from '@custom/schema';
import { GatsbyBrowser } from 'gatsby';

export const onClientEntry: GatsbyBrowser['onClientEntry'] = async () => {
registerOperator(drupalOperator(`/graphql`));
};

export const shouldUpdateScroll: GatsbyBrowser['shouldUpdateScroll'] = (
args,
) => {
Expand Down
3 changes: 2 additions & 1 deletion apps/website/gatsby-ssr.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import './styles.css';

import { Locale } from '@custom/schema';
import { drupalOperator, Locale, registerOperator } from '@custom/schema';
import { GatsbySSR } from 'gatsby';

export const onRenderBody: GatsbySSR['onRenderBody'] = ({
setHtmlAttributes,
pathname,
}) => {
registerOperator(drupalOperator(`/graphql`));
const locales = Object.values(Locale);
if (locales.length === 1) {
// Single-language project.
Expand Down
6 changes: 0 additions & 6 deletions apps/website/src/pages/content-hub.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import {
ContentHubQuery,
drupalOperator,
registerOperator,
} from '@custom/schema';
import { ContentHub } from '@custom/ui/routes/ContentHub';
import React from 'react';

Expand All @@ -12,6 +7,5 @@ export function Head() {
}

export default function ContentHubPage() {
registerOperator(drupalOperator(`/graphql`), ContentHubQuery);
return <ContentHub pageSize={6} />;
}
2 changes: 1 addition & 1 deletion packages/schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export function useOperation<TOperation extends AnyOperationId>(
suspense: false,
},
);
return result.data?.data;
return result.data;
}
8 changes: 7 additions & 1 deletion packages/ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import '../tailwind.css';

import { Decorator } from '@storybook/react';
import { IntlProvider } from '../src/utils/intl';
import { LocationProvider } from '@custom/schema';
import {
LocationProvider,
drupalOperator,
registerOperator,
} from '@custom/schema';
import React from 'react';
import { initialize, mswLoader } from 'msw-storybook-addon';

Expand All @@ -13,6 +17,8 @@ const IntlDecorator: Decorator = (Story) => (
</IntlProvider>
);

registerOperator(drupalOperator('/graphql'));

const LocationDecorator: Decorator = (Story, ctx) => {
return (
<LocationProvider currentLocation={ctx.parameters.location}>
Expand Down

0 comments on commit 02bcd82

Please sign in to comment.