Context
Hi everyone,
I wanted to get your perspective on choosing between API-level (tag-based) revalidation and page-level revalidation in a production application.
In our use case (a marketplace-style application), multiple pages consume shared data such as:
- Property details
- Related properties
- Agent information
- Location data
- Reviews
Revalidation Strategies
We are evaluating whether it is better to:
- Use
revalidateTag()to invalidate specific cached data (API-level revalidation). - Use
revalidatePath()to invalidate entire pages (page-level revalidation).
Architectural Considerations
- API-level revalidation:
revalidateTag()seems more granular and efficient, as it refreshes only the affected data and avoids unnecessary full-page rebuilds. - Page-level revalidation:
revalidatePath()is simpler but may cause all data-fetching logic within a route to execute again, even if only a small section changed.
In a high-traffic, data-heavy application, would you recommend prioritizing tag-based revalidation for scalability and cost efficiency?
Are there specific scenarios where page-level revalidation would still be preferable?
Looking forward to your guidance.