Rocky_Mountain_Vending/.pnpm-store/v10/files/7f/ff1cc67a6988a1818cf7896e559f388a0f2640de8f3a852e453b602e7ecce5bb5e6665080129569e049e8da1dba4a89ca3163e971d6643a343c8d5f27625d7
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
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>
2026-02-12 16:22:15 -07:00

65 lines
No EOL
3.3 KiB
Text

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "serverPatchReducer", {
enumerable: true,
get: function() {
return serverPatchReducer;
}
});
const _createhreffromurl = require("../create-href-from-url");
const _applyrouterstatepatchtotree = require("../apply-router-state-patch-to-tree");
const _isnavigatingtonewrootlayout = require("../is-navigating-to-new-root-layout");
const _navigatereducer = require("./navigate-reducer");
const _applyflightdata = require("../apply-flight-data");
const _handlemutable = require("../handle-mutable");
const _approuter = require("../../app-router");
function serverPatchReducer(state, action) {
const { serverResponse, navigatedAt } = action;
const mutable = {};
mutable.preserveCustomHistoryState = false;
// Handle case when navigating to page in `pages` from `app`
if (typeof serverResponse === 'string') {
return (0, _navigatereducer.handleExternalUrl)(state, mutable, serverResponse, state.pushRef.pendingPush);
}
const { flightData, canonicalUrl, renderedSearch } = serverResponse;
let currentTree = state.tree;
let currentCache = state.cache;
for (const normalizedFlightData of flightData){
const { segmentPath: flightSegmentPath, tree: treePatch } = normalizedFlightData;
const newTree = (0, _applyrouterstatepatchtotree.applyRouterStatePatchToTree)(// TODO-APP: remove ''
[
'',
...flightSegmentPath
], currentTree, treePatch, state.canonicalUrl);
// `applyRouterStatePatchToTree` returns `null` when it determined that the server response is not applicable to the current tree.
// In other words, the server responded with a tree that doesn't match what the client is currently rendering.
// This can happen if the server patch action took longer to resolve than a subsequent navigation which would have changed the tree.
// Previously this case triggered an MPA navigation but it should be safe to simply discard the server response rather than forcing
// the entire page to reload.
if (newTree === null) {
return state;
}
if ((0, _isnavigatingtonewrootlayout.isNavigatingToNewRootLayout)(currentTree, newTree)) {
return (0, _navigatereducer.handleExternalUrl)(state, mutable, state.canonicalUrl, state.pushRef.pendingPush);
}
mutable.canonicalUrl = (0, _createhreffromurl.createHrefFromUrl)(canonicalUrl);
const cache = (0, _approuter.createEmptyCacheNode)();
(0, _applyflightdata.applyFlightData)(navigatedAt, currentCache, cache, normalizedFlightData);
mutable.patchedTree = newTree;
mutable.renderedSearch = renderedSearch;
mutable.cache = cache;
currentCache = cache;
currentTree = newTree;
}
return (0, _handlemutable.handleMutable)(state, mutable);
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=server-patch-reducer.js.map