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: add missing optional chaining operator #120

Merged
merged 2 commits into from
Oct 3, 2023
Merged

fix: add missing optional chaining operator #120

merged 2 commits into from
Oct 3, 2023

Conversation

soudasuwa
Copy link
Contributor

@soudasuwa soudasuwa commented Sep 29, 2023

Description

Add missing ?. optional chaining operator in export async function generateMetadata in recipes/next/app/[...puckPath]/page.tsx.

Error:

next-recipe:dev:  ⨯ app/[...puckPath]/page.tsx (31:25) @ root
next-recipe:dev:  ⨯ TypeError: Cannot read properties of undefined (reading 'root')
next-recipe:dev:     at Module.generateMetadata (./app/[...puckPath]/page.tsx:32:29)
next-recipe:dev: digest: "1676022290"
next-recipe:dev:   29 | 
next-recipe:dev:   30 |   return {
next-recipe:dev: > 31 |     title: getPage(path).root.title,
next-recipe:dev:      |                         ^
next-recipe:dev:   32 |   };
next-recipe:dev:   33 | }
next-recipe:dev:   34 |

Why this happens:

By default the browser attempts to load the http://localhost:3000/favicon.ico file but because this file does not exist as a static file, next.js server attempts to handle the request using /app/[...puckPath]/page.tsx route and because favicon.ico path is not defined in /database.json this error occurs.

Steps to reproduce:

Option 1.

Clone this repo

git clone [email protected]:measuredco/puck.git
cd puck

Start dev

yarn dev --scope next-recipe --no-deps

Option 2.

Create new project using next recipe

npx create-puck-app my-app
cd my-app

Start dev

yarn dev

Open puck editor

Browser navigate to -> http://localhost:3000/edit

Commit that introduced this error

34f248c#diff-03f6d84aea18b78020e4edaabac75a948a5c6b56b5212194570e0364684f3f41R31

Environment

$ uname -a
Linux *** 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ node -v
v18.17.1
$ yarn -v
1.22.19
$ git rev-parse HEAD
e4cab76e385ba735778de9cb2514a15338ead10a

Browser:
Microsoft Edge
Version 117.0.2045.43 (Official build) (64-bit)

@vercel
Copy link

vercel bot commented Sep 29, 2023

@soudasuwa is attempting to deploy a commit to the Measured Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Oct 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
puck-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2023 5:49pm

Copy link
Member

@chrisvxd chrisvxd left a comment

Choose a reason for hiding this comment

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

🚀

@chrisvxd chrisvxd merged commit a368319 into measuredco:main Oct 3, 2023
2 checks passed
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.

2 participants