Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
No EOL
766 B
Text
16 lines
No EOL
766 B
Text
import { PAGE_SEGMENT_KEY } from '../../../shared/lib/segment';
|
|
export function createRouterCacheKey(segment, withoutSearchParameters = false) {
|
|
// if the segment is an array, it means it's a dynamic segment
|
|
// for example, ['lang', 'en', 'd']. We need to convert it to a string to store it as a cache node key.
|
|
if (Array.isArray(segment)) {
|
|
return `${segment[0]}|${segment[1]}|${segment[2]}`;
|
|
}
|
|
// Page segments might have search parameters, ie __PAGE__?foo=bar
|
|
// When `withoutSearchParameters` is true, we only want to return the page segment
|
|
if (withoutSearchParameters && segment.startsWith(PAGE_SEGMENT_KEY)) {
|
|
return PAGE_SEGMENT_KEY;
|
|
}
|
|
return segment;
|
|
}
|
|
|
|
//# sourceMappingURL=create-router-cache-key.js.map |