You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if we run this code at build time, we need to use [generateStaticParams](https://nextjs.org/docs/app/api-reference/functions/generate-static-params) too:
What's if `api-server` has new data, let's use [Incremental Static Regeneration or Revalidating Data](https://nextjs.org/docs/app/building-your-application/data-fetching/revalidating):
> It also have [on-demand revalidation](https://nextjs.org/docs/app/building-your-application/data-fetching/revalidating#using-on-demand-revalidation)
388
+
> It also have other [on-demand revalidation](https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration#time-based-revalidation) options
365
389
366
390
Run again:
367
391
@@ -373,17 +397,17 @@ npm run start:prod
373
397
374
398
Open browser at `http://localhost:8080/cars` and then add a new car:
375
399
376
-
_./api-server/mock-data/data.json_
400
+
_./api-server/src/mock-data.ts_
377
401
378
402
```diff
379
403
...
380
-
+{
381
-
+ "id": "10",
382
-
+ "name": "New car",
383
-
+ "imageUrl": "/audi-q8.png",
384
-
+ "features": [],
385
-
+ "isBooked": false
386
-
+ }
404
+
+ {
405
+
+id: '10',
406
+
+ name: 'New car',
407
+
+ imageUrl: '/audi-q8.png',
408
+
+ features: [],
409
+
+ isBooked: false,
410
+
+},
387
411
```
388
412
389
413
While we navigate to car details:(`/cars/1`, `/cars/2`,...`/cars/4`) it doesn't update the car list.
@@ -394,17 +418,17 @@ If we refresh the `/cars` page again (F5) it pre-renders the `car page again` an
394
418
395
419
Remove data:
396
420
397
-
_./api-server/mock-data/data.json_
421
+
_./api-server/src/mock-data.ts_
398
422
399
423
```diff
400
424
...
401
-
-{
402
-
- "id": "10",
403
-
- "name": "New car",
404
-
- "imageUrl": "/vw-touran.png",
405
-
- "features": [],
406
-
- "isBooked": false
407
-
- }
425
+
- {
426
+
-id: '10',
427
+
- name: 'New car',
428
+
- imageUrl: '/audi-q8.png',
429
+
- features: [],
430
+
- isBooked: false,
431
+
-},
408
432
```
409
433
410
434
For fix `images` on car details, we nee to add a `domain` to 'optimize images with `next/image` hosted in external service:
0 commit comments