Revalidate the site layout when a global is saved
buildGlobalRevalidateHook + ipalKit({ revalidatePath }) wires it into the
plugin's globals; menus, consent texts and analytics IDs no longer stay
stale for the whole ISR window.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7c05a1dba9
commit
7967453f57
@@ -42,6 +42,24 @@ brak `process.env.NEXT_RUNTIME`. Wcześniej Next rzucał `Invariant: static gene
|
||||
i seed padał. Celowe pominięcie (masowy import w aplikacji): `context: { disableRevalidate: true }`
|
||||
w wywołaniu Local API.
|
||||
|
||||
### Globale — buildGlobalRevalidateHook / `ipalKit({ revalidatePath })`
|
||||
|
||||
Global (Site Settings, Cookie Settings, menu projektu) zasila layout **każdej** strony — logo, menu,
|
||||
teksty zgody, ID analityki. Bez rewalidacji strony ISR trzymały stare wartości do końca okna
|
||||
`revalidate`. Zapis globala → `revalidatePath('/', 'layout')` (cała strona).
|
||||
|
||||
```ts
|
||||
// payload.config.ts — globale pluginu (Site Settings, Site Integrations, Cookie Settings, Notifications)
|
||||
import { revalidatePath } from 'next/cache'
|
||||
ipalKit({ …, revalidatePath })
|
||||
|
||||
// własny global projektu (np. menu)
|
||||
import { buildGlobalRevalidateHook } from '@intecion/ipal-kit'
|
||||
hooks: { afterChange: [buildGlobalRevalidateHook({ revalidatePath })] }
|
||||
```
|
||||
|
||||
Te same reguły co wyżej: bez `NEXT_RUNTIME` i z `context: { disableRevalidate: true }` nic nie robi.
|
||||
|
||||
---
|
||||
|
||||
## setPublishedAtHook — auto-data publikacji
|
||||
|
||||
Reference in New Issue
Block a user