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

Fix preview #320

Merged
merged 3 commits into from
Jan 3, 2024
Merged

Fix preview #320

merged 3 commits into from
Jan 3, 2024

Conversation

tjheffner
Copy link
Contributor

Description

yarn build:preview wasn't working properly because the existing cache check would attempt to use the cache even if redis wasn't present. this has been corrected.

i also fixed a warning for a useEffect dep in events.

Testing done

before:

$ yarn build:preview
Using environment variables from: envs/.env.local

./src/lib/drupal/lovell/tests/staticProps.test.ts
46:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
47:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
48:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
88:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
128:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
162:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests

./src/lib/drupal/lovell/tests/utils.test.ts
43:3  Warning: Some tests seem to be commented  jest/no-commented-out-tests

./src/templates/layouts/event/index.tsx
49:6  Warning: React Hook useEffect has a missing dependency: 'formattedDates'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
 ✓ Linting and checking validity of types
 ✓ Creating an optimized production build
 ✓ Compiled successfully
 ✓ Collecting page data
   Generating static pages (1/3)  [=   ]
Failed to fetch global elements: TypeError: Cannot read properties of null (reading 'get')
    at /Users/heffner/dev/next-build/node_modules/next-drupal/dist/index.js:2235:48
    at DrupalClient.getMenu (/Users/heffner/dev/next-build/node_modules/next-drupal/dist/index.js:2246:8)
    at getMenu (/Users/heffner/dev/next-build/.next/server/chunks/315.js:1:3459)
    at Module.headerFooter_data (/Users/heffner/dev/next-build/.next/server/chunks/315.js:1:14754)
    at getRawData (/Users/heffner/dev/next-build/node_modules/next-drupal-query/dist/index.js:145:43)
    at /Users/heffner/dev/next-build/node_modules/next-drupal-query/dist/index.js:103:34
    at Object.getData (/Users/heffner/dev/next-build/node_modules/next-drupal-query/dist/index.js:109:8)
    at getGlobalElements (/Users/heffner/dev/next-build/.next/server/chunks/65.js:1:269)
    at getStaticProps (/Users/heffner/dev/next-build/.next/server/pages/404.js:1:2003)
    at /Users/heffner/dev/next-build/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js:47:4097

Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Your `getStaticProps` function did not return an object. Did you forget to add a `return`?
    at eZ (/Users/heffner/dev/next-build/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js:47:4313)
    at async exportPages (/Users/heffner/dev/next-build/node_modules/next/dist/export/routes/pages.js:84:28)
    at async exportPageImpl (/Users/heffner/dev/next-build/node_modules/next/dist/export/worker.js:191:16)
    at async /Users/heffner/dev/next-build/node_modules/next/dist/export/worker.js:219:16
    at async Span.traceAsyncFn (/Users/heffner/dev/next-build/node_modules/next/dist/trace/trace.js:105:20)
 ✓ Generating static pages (3/3)

> Export encountered errors on following paths:
	/404

after:

$ yarn build:preview
Using environment variables from: envs/.env.local

./src/lib/drupal/lovell/tests/staticProps.test.ts
46:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
47:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
48:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
88:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
128:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests
162:1  Warning: Some tests seem to be commented  jest/no-commented-out-tests

./src/lib/drupal/lovell/tests/utils.test.ts
43:3  Warning: Some tests seem to be commented  jest/no-commented-out-tests

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
 ✓ Linting and checking validity of types
 ✓ Creating an optimized production build
 ✓ Compiled successfully
 ✓ Collecting page data
 ✓ Generating static pages (3/3)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (pages)                              Size     First Load JS
┌   /_app                                  0 B            94.7 kB
├ ● /_playground/api-explorer              328 B            95 kB
├ ● /[[...slug]]                           8.51 kB         113 kB
├ ○ /404                                   3.63 kB         109 kB
├ λ /api/exit-preview                      0 B            94.7 kB
└ λ /api/preview                           0 B            94.7 kB
+ First Load JS shared by all              96.3 kB
  ├ chunks/framework-5666885447fdc3cc.js   45.3 kB
  ├ chunks/main-a0309a66b042c9e7.js        32.9 kB
  ├ chunks/pages/_app-61b62de0998be7ed.js  13.9 kB
  ├ chunks/webpack-cd3edff39541e468.js     2.58 kB
  └ css/20fbada41bacb5ed.css               1.62 kB

λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
○  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)

QA steps

What needs to be checked to prove this works?
What needs to be checked to prove it didn't break any related things?
What variations of circumstances (users, actions, values) need to be checked?

Tasks

Preview Give feedback

@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 3, 2024 21:08 Destroyed
@tjheffner tjheffner requested review from jtmst and ryguyk January 3, 2024 21:08
@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 3, 2024 22:19 Destroyed
Copy link
Contributor

@timcosgrove timcosgrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

@tjheffner tjheffner merged commit 17a5ce0 into main Jan 3, 2024
6 checks passed
@tjheffner tjheffner deleted the fix-preview branch January 3, 2024 22:48
tjheffner added a commit that referenced this pull request Jan 9, 2024
Co-authored-by: Tim Cosgrove <timcosgrove@users.noreply.github.com>
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.

3 participants