Skip to content

Commit

Permalink
Misc reorder SSG pages (getStaticPaths before getStaticProps) for con…
Browse files Browse the repository at this point in the history
…sistency with Next.js own example (and makes more sense from a dev standpoint too)
  • Loading branch information
Vadorequest committed May 28, 2020
1 parent d46366f commit 0d0714c
Show file tree
Hide file tree
Showing 34 changed files with 201 additions and 201 deletions.
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -31,12 +37,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/animations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -31,12 +37,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/css-in-js.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -31,12 +37,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/docs-site.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -30,12 +36,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -30,12 +36,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/hosting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -31,12 +37,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -31,12 +37,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[locale]/examples/built-in-features/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import HostingPage, { getStaticPaths as getStaticPathsHomePage, getStaticProps as getStaticPropsHomePage } from './hosting';

// XXX This page is an "alias"
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getStaticPropsHomePage;
export const getStaticPaths: GetStaticPaths<StaticParams> = getStaticPathsHomePage;
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getStaticPropsHomePage;

export default HostingPage;
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -30,12 +36,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/monitoring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -30,12 +36,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -31,12 +37,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/static-i18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -33,12 +39,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-features/ui-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -32,12 +38,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
12 changes: 6 additions & 6 deletions src/pages/[locale]/examples/built-in-utilities/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -29,12 +35,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -29,12 +35,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
label: fileLabel,
});

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* Only executed on the server side at build time.
*
Expand All @@ -32,12 +38,6 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getCommonStaticProps;

/**
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getCommonStaticPaths;

/**
* SSG pages are first rendered by the server (during static bundling)
* Then, they're rendered by the client, and gain additional props (defined in OnlyBrowserPageProps)
Expand Down
Loading

0 comments on commit 0d0714c

Please sign in to comment.