Skip to content
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

Preload app-wide shared data #334

Merged
merged 26 commits into from
May 26, 2021
Merged

Conversation

Vadorequest
Copy link
Member

@Vadorequest Vadorequest commented May 26, 2021

Uses https://github.com/ricokahler/next-plugin-preval to pre-fetch app-wide static data during build (webpack bundle)

  • Optimize I/O by fetching the API much less during build (once per table, instead of multiple times per page, per locale and per table) - O(n3) => O(n)
  • Auto-detect locale API endpoint now redirects to a proper localized page (based on the customer's allowed locales)
  • Generates only pages for enabled locales (build is now faster, undesired static pages aren't generated at build time)
  • Doesn't break the native "preview" mode, when preview is enabled, static pages (SSG) perform real-time API requests instead of using static/stale app-wide data

Before 123 static pages generated

image

After 85 static pages generated (because customer1 doesn't have en-US language enabled)

image


Before 7 API calls (although fetching only 3 tables, because Next.js pages generation are processed in parallel and cache doesn't take effect immediately)

image

After 3 API calls

image

@github-actions github-actions bot temporarily deployed to customer1-staging May 26, 2021 13:20 Inactive
@github-actions github-actions bot temporarily deployed to storybook May 26, 2021 13:20 Inactive
@github-actions
Copy link

@github-actions
Copy link

✅  Deployment SUCCESS
Commit 526fd78 successfully deployed Storybook static site 📖 to https://nrn-v2-mst-aptd-at-lcz-sty-storybook-50ueuciw4-unly-oss.vercel.app
Deployment aliases (1): nrn-v2-mst-aptd-at-lcz-sty-storybook.vercel.app

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 526fd78 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-r70wc4gj1-unly-oss.vercel.app

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 526fd78 previously deployed Storybook static site at https://nrn-v2-mst-aptd-at-lcz-sty-storybook-50ueuciw4-unly-oss.vercel.app

@github-actions github-actions bot temporarily deployed to customer1-staging May 26, 2021 14:49 Inactive
@github-actions github-actions bot temporarily deployed to storybook May 26, 2021 14:49 Inactive
@github-actions
Copy link

@github-actions
Copy link

✅  Deployment SUCCESS
Commit a89bba6 successfully deployed Storybook static site 📖 to https://nrn-v2-mst-aptd-at-lcz-sty-storybook-6qdt18mle-unly-oss.vercel.app
Deployment aliases (1): nrn-v2-mst-aptd-at-lcz-sty-storybook.vercel.app

@github-actions
Copy link

✅  E2E tests SUCCESS for commit a89bba6 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-7h8pa0oxg-unly-oss.vercel.app

@github-actions
Copy link

✅  E2E tests SUCCESS for commit a89bba6 previously deployed Storybook static site at https://nrn-v2-mst-aptd-at-lcz-sty-storybook-6qdt18mle-unly-oss.vercel.app

# Conflicts:
#	src/layouts/core/coreLayoutSSG.ts
#	src/layouts/core/coreLayoutSSR.ts
#	src/layouts/demo/demoLayoutSSG.ts
#	src/layouts/demo/demoLayoutSSR.ts
@github-actions github-actions bot temporarily deployed to customer1-staging May 26, 2021 15:15 Inactive
@github-actions
Copy link

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 8453255 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-l67jljrjo-unly-oss.vercel.app

@github-actions github-actions bot temporarily deployed to customer1-staging May 26, 2021 15:33 Inactive
@github-actions
Copy link

@github-actions
Copy link

@Vadorequest Vadorequest marked this pull request as ready for review May 26, 2021 17:28
@github-actions
Copy link

✅  E2E tests SUCCESS for commit cdac350 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-bbcie5bqo-unly-oss.vercel.app

@github-actions github-actions bot temporarily deployed to customer1-staging May 26, 2021 17:45 Inactive
@github-actions github-actions bot temporarily deployed to storybook May 26, 2021 17:46 Inactive
@github-actions
Copy link

@github-actions
Copy link

✅  Deployment SUCCESS
Commit 7f59a70 successfully deployed Storybook static site 📖 to https://nrn-v2-mst-aptd-at-lcz-sty-storybook-8ppgldqhg-unly-oss.vercel.app
Deployment aliases (1): nrn-v2-mst-aptd-at-lcz-sty-storybook.vercel.app

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 7f59a70 previously deployed Storybook static site at https://nrn-v2-mst-aptd-at-lcz-sty-storybook-8ppgldqhg-unly-oss.vercel.app

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 7f59a70 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-i0w4pxcoq-unly-oss.vercel.app

@github-actions github-actions bot temporarily deployed to customer1-staging May 26, 2021 19:19 Inactive
@github-actions github-actions bot temporarily deployed to customer1-staging May 26, 2021 19:24 Inactive
@github-actions
Copy link

@github-actions github-actions bot temporarily deployed to customer1-staging May 26, 2021 19:27 Inactive
@github-actions
Copy link

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 8ea139f previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-59lcrvt4r-unly-oss.vercel.app

@github-actions
Copy link

✅  E2E tests SUCCESS for commit e931394 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-kdgj6v4r3-unly-oss.vercel.app

@github-actions
Copy link

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 390f483 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-9hn3bjmjb-unly-oss.vercel.app

@Vadorequest Vadorequest merged commit fadf1d7 into v2-mst-aptd-at-lcz-sty May 26, 2021
@Vadorequest Vadorequest deleted the prefetch-shared-data branch May 26, 2021 19:56
Vadorequest added a commit that referenced this pull request May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant