Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
67 lines
2.7 KiB
JavaScript
67 lines
2.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.defineProperty(exports, "useUntrackedPathname", {
|
|
enumerable: true,
|
|
get: function() {
|
|
return useUntrackedPathname;
|
|
}
|
|
});
|
|
const _react = require("react");
|
|
const _hooksclientcontextsharedruntime = require("../../shared/lib/hooks-client-context.shared-runtime");
|
|
/**
|
|
* This checks to see if the current render has any unknown route parameters that
|
|
* would cause the pathname to be dynamic. It's used to trigger a different
|
|
* render path in the error boundary.
|
|
*
|
|
* @returns true if there are any unknown route parameters, false otherwise
|
|
*/ function hasFallbackRouteParams() {
|
|
if (typeof window === 'undefined') {
|
|
// AsyncLocalStorage should not be included in the client bundle.
|
|
const { workUnitAsyncStorage } = require('../../server/app-render/work-unit-async-storage.external');
|
|
const workUnitStore = workUnitAsyncStorage.getStore();
|
|
if (!workUnitStore) return false;
|
|
switch(workUnitStore.type){
|
|
case 'prerender':
|
|
case 'prerender-client':
|
|
case 'prerender-ppr':
|
|
case 'validation-client':
|
|
const fallbackParams = workUnitStore.fallbackRouteParams;
|
|
return fallbackParams ? fallbackParams.size > 0 : false;
|
|
case 'prerender-legacy':
|
|
case 'request':
|
|
case 'prerender-runtime':
|
|
case 'cache':
|
|
case 'private-cache':
|
|
case 'unstable-cache':
|
|
case 'generate-static-params':
|
|
break;
|
|
default:
|
|
workUnitStore;
|
|
}
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
function useUntrackedPathname() {
|
|
// If there are any unknown route parameters we would typically throw
|
|
// an error, but this internal method allows us to return a null value instead
|
|
// for components that do not propagate the pathname to the static shell (like
|
|
// the error boundary).
|
|
if (hasFallbackRouteParams()) {
|
|
return null;
|
|
}
|
|
// This shouldn't cause any issues related to conditional rendering because
|
|
// the environment will be consistent for the render.
|
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
return (0, _react.useContext)(_hooksclientcontextsharedruntime.PathnameContext);
|
|
}
|
|
|
|
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=navigation-untracked.js.map
|