main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
import { ACTION_NAVIGATE, ACTION_SERVER_PATCH, ACTION_RESTORE, ACTION_REFRESH, ACTION_PREFETCH, ACTION_FAST_REFRESH, ACTION_SERVER_ACTION } from "./router-reducer-types";
import { navigateReducer } from "./reducers/navigate-reducer";
import { serverPatchReducer } from "./reducers/server-patch-reducer";
import { restoreReducer } from "./reducers/restore-reducer";
import { refreshReducer } from "./reducers/refresh-reducer";
import { prefetchReducer } from "./reducers/prefetch-reducer";
import { fastRefreshReducer } from "./reducers/fast-refresh-reducer";
import { serverActionReducer } from "./reducers/server-action-reducer";
/**
* Reducer that handles the app-router state updates.
*/ function clientReducer(state, action) {
switch(action.type){
case ACTION_NAVIGATE:
{
return navigateReducer(state, action);
}
case ACTION_SERVER_PATCH:
{
return serverPatchReducer(state, action);
}
case ACTION_RESTORE:
{
return restoreReducer(state, action);
}
case ACTION_REFRESH:
{
return refreshReducer(state, action);
}
case ACTION_FAST_REFRESH:
{
return fastRefreshReducer(state, action);
}
case ACTION_PREFETCH:
{
return prefetchReducer(state, action);
}
case ACTION_SERVER_ACTION:
{
return serverActionReducer(state, action);
}
// This case should never be hit as dispatch is strongly typed.
default:
throw new Error("Unknown action");
}
}
function serverReducer(state, _action) {
return state;
}
// we don't run the client reducer on the server, so we use a noop function for better tree shaking
export const reducer = typeof window === "undefined" ? serverReducer : clientReducer;
//# sourceMappingURL=router-reducer.js.map