Skip to content

Commit

Permalink
Add PPR (#745)
Browse files Browse the repository at this point in the history
* Update to next v15, switch to pnpm

* Delete package-lock.json

* Add PPR

* Update to next@canary

* Update starter-example to next@canary

* Update file extension

* Update ts compiler options to match CNA

* Fix ts errors
  • Loading branch information
delbaoliveira authored Jun 19, 2024
1 parent 58f9a68 commit deca7c7
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 104 deletions.
2 changes: 2 additions & 0 deletions dashboard/final-example/app/dashboard/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import SideNav from '@/app/ui/dashboard/sidenav';

export const experimental_ppr = true;

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div className="flex h-screen flex-col md:flex-row md:overflow-hidden">
Expand Down
4 changes: 2 additions & 2 deletions dashboard/final-example/app/ui/invoices/create-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
UserCircleIcon,
} from '@heroicons/react/24/outline';
import { Button } from '@/app/ui/button';
import { createInvoice } from '@/app/lib/actions';
import { createInvoice, State } from '@/app/lib/actions';
import { useFormState } from 'react-dom';

export default function Form({ customers }: { customers: CustomerField[] }) {
const initialState = { message: null, errors: {} };
const initialState: State = { message: null, errors: {} };
const [state, dispatch] = useFormState(createInvoice, initialState);

return (
Expand Down
4 changes: 2 additions & 2 deletions dashboard/final-example/app/ui/invoices/edit-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@heroicons/react/24/outline';
import Link from 'next/link';
import { Button } from '@/app/ui/button';
import { updateInvoice } from '@/app/lib/actions';
import { updateInvoice, State } from '@/app/lib/actions';
import { useFormState } from 'react-dom';

export default function EditInvoiceForm({
Expand All @@ -19,7 +19,7 @@ export default function EditInvoiceForm({
invoice: InvoiceForm;
customers: CustomerField[];
}) {
const initialState = { message: null, errors: {} };
const initialState: State = { message: null, errors: {} };
const updateInvoiceWithId = updateInvoice.bind(null, invoice.id);
const [state, dispatch] = useFormState(updateInvoiceWithId, initialState);

Expand Down
9 changes: 9 additions & 0 deletions dashboard/final-example/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('next').NextConfig} */

const nextConfig = {
experimental: {
ppr: 'incremental',
},
};

export default nextConfig;
2 changes: 1 addition & 1 deletion dashboard/final-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"autoprefixer": "10.4.15",
"bcrypt": "^5.1.1",
"clsx": "^2.0.0",
"next": "15.0.0-rc.0",
"next": "15.0.0-canary.28",
"next-auth": "^5.0.0-beta.4",
"postcss": "8.4.31",
"react": "19.0.0-rc-6230622a1a-20240610",
Expand Down
86 changes: 43 additions & 43 deletions dashboard/final-example/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dashboard/final-example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
Expand Down
4 changes: 0 additions & 4 deletions dashboard/starter-example/next.config.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

module.exports = nextConfig;
export default nextConfig;
2 changes: 1 addition & 1 deletion dashboard/starter-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"autoprefixer": "10.4.15",
"bcrypt": "^5.1.1",
"clsx": "^2.0.0",
"next": "15.0.0-rc.0",
"next": "15.0.0-canary.28",
"postcss": "8.4.31",
"react": "19.0.0-rc-6230622a1a-20240610",
"react-dom": "19.0.0-rc-6230622a1a-20240610",
Expand Down
Loading

0 comments on commit deca7c7

Please sign in to comment.