Hydration failed because the initial UI does not match what was rendered on the server – getStaticProps page after backup restoration
26K reputation · 10 Feb 2021, 09:32 UTC
Objective
Determine a reliable method to immediately invalidate the Incremental Static Regeneration (ISR) cache for pages that use getStaticProps after an external data change such as a database backup restoration, while preserving the incremental benefits of ISR and avoiding unnecessary full rebuilds.
Constraints include the absence of a built‑in server‑only API to trigger revalidation from outside the Next.js process, the need to avoid downtime or lost incremental gains, and the risk of UI inconsistency if stale HTML remains served.
- What mechanism can safely expose an internal revalidation trigger to external scripts (e.g., backup‑restore workflows)?
- Should Next.js provide a dedicated server‑only route or function to purge ISR cache for specific routes on demand?
- How can teams automate cache invalidation after backup restoration without causing a temporary mismatch between server‑rendered and client‑rendered views?