-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathpage.tsx
More file actions
37 lines (30 loc) · 793 Bytes
/
page.tsx
File metadata and controls
37 lines (30 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as Sentry from '@sentry/nextjs';
function fetchPost() {
return Promise.resolve({ id: '1', title: 'Post 1' });
}
export async function generateMetadata() {
const { id } = await fetchPost();
const product = `Product: ${id}`;
return {
title: product,
};
}
export default function Page() {
return (
<>
<h1>This will be pre-rendered</h1>
<DynamicContent />
</>
);
}
async function DynamicContent() {
const getTodos = async () => {
return Sentry.startSpan({ name: 'getTodos', op: 'get.todos' }, async () => {
'use cache';
await new Promise(resolve => setTimeout(resolve, 100));
return [1, 2, 3, 4, 5];
});
};
const todos = await getTodos();
return <div id="todos-fetched">Todos fetched: {todos.length}</div>;
}