I’m working through David Lorenz’s book Building Production-Grade Web Applications with Supabase (affiliate link) and just finished Chapter 3 – Creating the Ticket Management Pages…. I’ve run into a few issues and thought I’d share them along with how I’ve fixed them.
Section: Setting up Pico.css with Next.js
You can ignore pageProps.children and leave it as children.
Section: Building the login form
Should I really edit app/page.js as LoginPageBuilding Production-Grade Web Applications with Supabase – Part 2
Even though Lorenz explicitly states:
So, open up app/page.js and change the Page component so that it only will return the Login component for now…
I still had to go look for myself the next time I encountered instructions to edit LoginPage. I expected us to create a new page rather than using the existing page.js, but no, wipe everything out in page.js and paste in only the LoginPage code as given in the book.
Error: searchParams should be awaited
Once we update the app/Login.js with the toggling logic (for turning on/off the password field) we start seeing this error:
Error: Route "/" used `searchParams.magicLink`. `searchParams` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis at LoginPage (src/app/page.js:3:38) 1 | import { Login } from "./Login"; 2 | export default function LoginPage({ searchParams }) { > 3 | const wantsMagicLink = searchParams.magicLink === "yes"; | ^ 4 | return <login ispasswordlogin="{!wantsMagicLink}"></login>; 5 | }
To fix this we want to make the LoginPage function in app/page.js asynchronous like so:
import { Login } from "./Login"; export default async function LoginPage({ searchParams }) { const params = await searchParams; const wantsMagicLink = params.magicLink === "yes"; return <login ispasswordlogin="{!wantsMagicLink}"></login>; }
Saving the Username and Password
In the book we are instructed to update our code in Login.js like so:
"use client"; import { useRef } from "react"; export const Login = () => { const emailInputRef = useRef(null); const passwordInputRef = useRef(null); return ( ... ) }
Just in case this isn’t entirely clear, here is what your code should look like:
"use client"; import { useRef } from "react"; import Link from "next/link"; export const Login = ({ isPasswordLogin }) => { const emailInputRef = useRef(null); const passwordInputRef = useRef(null); return( ... ) }
Where the ... is we aren’t changing anything. Essentially, everything from return( on remains the exact same as before.
The “big thing” I’m pointing out above is that one shouldn’t remove import Link from "next/link"; instead add "use client"; and the useRef import before it.
Side note: Maybe we’ll learn later, but I find it a little odd to use useRef instead of useState here, but then again, I’m not a Next.js or React expert.
Where does that onSubmit event goBuilding Production-Grade Web Applications with Supabase – Part 2
In Login.js within the return( ... ), replace the current
The above is the detailed content of Building Production-Grade Web Applications with Supabase – Part 2. For more information, please follow other related articles on the PHP Chinese website!

This is the 3rd post in a small series we did on form accessibility. If you missed the second post, check out "Managing User Focus with :focus-visible". In

The CSS box-shadow and outline properties gained theme.json support in WordPress 6.1. Let's look at a few examples of how it works in real themes, and what options we have to apply these styles to WordPress blocks and elements.

The Svelte transition API provides a way to animate components when they enter or leave the document, including custom Svelte transitions.

If you’ve recently started working with GraphQL, or reviewed its pros and cons, you’ve no doubt heard things like “GraphQL doesn’t support caching” or

In this article we will be diving into the world of scrollbars. I know, it doesn’t sound too glamorous, but trust me, a well-designed page goes hand-in-hand

How much time do you spend designing the content presentation for your websites? When you write a new blog post or create a new page, are you thinking about

With the recent climb of Bitcoin’s price over 20k $USD, and to it recently breaking 30k, I thought it’s worth taking a deep dive back into creating Ethereum

npm commands run various tasks for you, either as a one-off or a continuously running process for things like starting a server or compiling code.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.