Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mutable field from action types #59221

Merged
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
5 changes: 0 additions & 5 deletions packages/next/src/client/components/app-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ function useServerActionDispatcher(dispatch: React.Dispatch<ReducerActions>) {
dispatch({
...actionPayload,
type: ACTION_SERVER_ACTION,
mutable: {},
})
})
},
Expand All @@ -189,7 +188,6 @@ function useChangeByServerResponse(
flightData,
previousTree,
overrideCanonicalUrl,
mutable: {},
})
})
},
Expand All @@ -209,7 +207,6 @@ function useNavigate(dispatch: React.Dispatch<ReducerActions>): RouterNavigate {
locationSearch: location.search,
shouldScroll: shouldScroll ?? true,
navigateType,
mutable: {},
})
},
[dispatch]
Expand Down Expand Up @@ -329,7 +326,6 @@ function Router({
startTransition(() => {
dispatch({
type: ACTION_REFRESH,
mutable: {},
origin: window.location.origin,
})
})
Expand All @@ -344,7 +340,6 @@ function Router({
startTransition(() => {
dispatch({
type: ACTION_FAST_REFRESH,
mutable: {},
origin: window.location.origin,
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
ReadonlyReducerState,
ReducerState,
FastRefreshAction,
Mutable,
} from '../router-reducer-types'
import { handleExternalUrl } from './navigate-reducer'
import { handleMutable } from '../handle-mutable'
Expand All @@ -18,16 +19,10 @@ function fastRefreshReducerImpl(
state: ReadonlyReducerState,
action: FastRefreshAction
): ReducerState {
const { mutable, origin } = action
const { origin } = action
const mutable: Mutable = {}
const href = state.canonicalUrl

const isForCurrentTree =
JSON.stringify(mutable.previousTree) === JSON.stringify(state.tree)

if (isForCurrentTree) {
return handleMutable(state, mutable)
}

mutable.preserveCustomHistoryState = false

const cache: CacheNode = createEmptyCacheNode()
Expand Down Expand Up @@ -102,7 +97,6 @@ function fastRefreshReducerImpl(
currentCache = cache
}

mutable.previousTree = currentTree
mutable.patchedTree = newTree
mutable.canonicalUrl = href

Expand Down
Loading