Skip to content

Commit

Permalink
fix: suppress missing arguments error in other way
Browse files Browse the repository at this point in the history
Apparently, Gatsby waits for the callback call if createPages has the callback in its definition. Before this commit the build was stuck at "createPages" step.
  • Loading branch information
Leksat committed Jun 1, 2021
1 parent 6ac7d6d commit 7129885
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
14 changes: 7 additions & 7 deletions apps/silverback-gatsby/gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { GatsbyNode } from 'gatsby';
import { createArticlePages } from './src/gatsby-node-helpers/create-pages/articles';
import { createGutenbergPages } from './src/gatsby-node-helpers/create-pages/gutenberg-pages';

export const createPages: GatsbyNode['createPages'] = async (
args,
options,
callback,
) => {
await createArticlePages(args, options, callback);
await createGutenbergPages(args, options, callback);
export type CreatePagesArgs = Parameters<
Required<GatsbyNode>['createPages']
>[0];

export const createPages: GatsbyNode['createPages'] = async (args) => {
await createArticlePages(args);
await createGutenbergPages(args);
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { GatsbyNode } from 'gatsby';

import { CreatePagesArgs } from '../../../gatsby-node';
import { languages } from '../../constants/languages';
import { ArticleContext } from '../../types/page-context';

export const createArticlePages: Required<GatsbyNode>['createPages'] = async ({
export const createArticlePages = async ({
graphql,
actions,
}) => {
}: CreatePagesArgs): Promise<void> => {
// Create article pages. Notice that we fetch from Gatsby GraphQL, not from
// Drupal.
const { data, errors } = await graphql<AllArticlesQuery>(`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { GatsbyNode } from 'gatsby';

import { CreatePagesArgs } from '../../../gatsby-node';
import { languages } from '../../constants/languages';
import { GutenbergPageContext } from '../../types/page-context';

export const createGutenbergPages: Required<GatsbyNode>['createPages'] = async ({
export const createGutenbergPages = async ({
graphql,
actions,
}) => {
}: CreatePagesArgs): Promise<void> => {
const { data, errors } = await graphql<AllGutenbergPagesQuery>(`
query AllGutenbergPages {
allDrupalGutenbergPageTranslations {
Expand Down

0 comments on commit 7129885

Please sign in to comment.