Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ env:
# defaults to 256, but we run a lot of tests in parallel, so the limit should be lower
NEXT_TURBOPACK_IO_CONCURRENCY: 64

# Disable warnings from baseline-browser-mapping
# https://github.com/web-platform-dx/baseline-browser-mapping/blob/ec8136ae9e034b332fab991d63a340d2e13b8afc/README.md?plain=1#L34
BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA: 1

jobs:
build:
timeout-minutes: ${{ inputs.timeout_minutes }}
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ test/integration/typescript-app-type-declarations/next-env.strictRouteTypes.d.ts
/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/tsx/lib.tsx

/apps/docs/.source/*
/apps/*/next-env.d.ts

# Symlink files
readme.md
Expand Down
4 changes: 0 additions & 4 deletions crates/next-core/src/pages_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ async fn get_pages_structure_for_root_directory(
get_pages_structure_for_directory(
dir_project_path.clone(),
next_router_path.join(name)?,
1,
page_extensions,
)
.to_resolved()
Expand All @@ -222,7 +221,6 @@ async fn get_pages_structure_for_root_directory(
get_pages_structure_for_directory(
dir_project_path.clone(),
next_router_path.join(name)?,
1,
page_extensions,
),
));
Expand Down Expand Up @@ -325,7 +323,6 @@ async fn get_pages_structure_for_root_directory(
async fn get_pages_structure_for_directory(
project_path: FileSystemPath,
next_router_path: FileSystemPath,
position: u32,
page_extensions: Vc<Vec<RcStr>>,
) -> Result<Vc<PagesDirectoryStructure>> {
let span = tracing::info_span!(
Expand Down Expand Up @@ -368,7 +365,6 @@ async fn get_pages_structure_for_directory(
get_pages_structure_for_directory(
dir_project_path.clone(),
next_router_path.join(name)?,
position + 1,
page_extensions,
),
));
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"dependencies": {
"@next/env": "16.2.0-canary.14",
"@swc/helpers": "0.5.15",
"baseline-browser-mapping": "^2.8.3",
"baseline-browser-mapping": "^2.9.19",
"caniuse-lite": "^1.0.30001579",
"postcss": "8.4.31",
"styled-jsx": "5.1.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ import {
convertServerPatchToFullTree,
navigateToKnownRoute,
} from '../../segment-cache/navigation'
import { revalidateEntireCache } from '../../segment-cache/cache'
import { invalidateSegmentCacheEntries } from '../../segment-cache/cache'
import { hasInterceptionRouteInCurrentTree } from './has-interception-route-in-current-tree'
import { FreshnessPolicy } from '../ppr-navigations'
import { invalidateBfCache } from '../../segment-cache/bfcache'

export function refreshReducer(state: ReadonlyReducerState): ReducerState {
// TODO: Currently, all refreshes purge the prefetch cache. In the future,
// only client-side refreshes will have this behavior; the server-side
// `refresh` should send new data without purging the prefetch cache.
// During a refresh, we invalidate the segment cache but not the route cache.
// The route cache contains the tree structure (which segments exist at a
// given URL) which doesn't change during a refresh. The segment cache
// contains the actual RSC data which needs to be re-fetched.
const currentNextUrl = state.nextUrl
const currentRouterState = state.tree
revalidateEntireCache(currentNextUrl, currentRouterState)
invalidateSegmentCacheEntries(currentNextUrl, currentRouterState)
return refreshDynamicData(state, FreshnessPolicy.RefreshAll)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import {
extractInfoFromServerReferenceId,
omitUnusedArgs,
} from '../../../../shared/lib/server-reference-info'
import { revalidateEntireCache } from '../../segment-cache/cache'
import { invalidateEntirePrefetchCache } from '../../segment-cache/cache'
import { startRevalidationCooldown } from '../../segment-cache/scheduler'
import { getDeploymentId } from '../../../../shared/lib/deployment-id'
import {
completeHardNavigation,
Expand Down Expand Up @@ -291,11 +292,19 @@ export function serverActionReducer(
// (ie, due to a navigation, before the action completed)
action.didRevalidate = true

// If there was a revalidation, evict the entire prefetch cache.
// If there was a revalidation, evict the prefetch cache.
// TODO: Evict only segments with matching tags and/or paths.
// TODO: We should only invalidate the route cache if cookies were
// mutated, since route trees may vary based on cookies. For now we
// invalidate both caches until we have a way to detect cookie
// mutations on the client.
if (revalidationKind === ActionDidRevalidateStaticAndDynamic) {
revalidateEntireCache(nextUrl, state.tree)
invalidateEntirePrefetchCache(nextUrl, state.tree)
}

// Start a cooldown before re-prefetching to allow CDN cache
// propagation.
startRevalidationCooldown()
}

const navigateType = redirectType || 'push'
Expand Down
Loading
Loading