Rocky_Mountain_Vending/.pnpm-store/v10/files/d6/838223513dc534944b4c11b633ad6c0804ef37207900f8cc124fdb3283e75f1855bd286cfb07af4416956cdc9914b61c994abd92ac9b46c5250bbc3ef54a71
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

72 lines
No EOL
3.2 KiB
Text

import { HMR_MESSAGE_SENT_TO_BROWSER } from '../../server/dev/hot-reloader-types';
import connect from './hot-reloader/pages/hot-reloader-pages';
import { sendMessage } from './hot-reloader/pages/websocket';
let reloading = false;
export default (()=>{
const devClient = connect();
devClient.subscribeToHmrEvent((message)=>{
if (reloading) return;
// Retrieve the router if it's available
const router = window.next?.router;
// Determine if we're on an error page or the router is not initialized
const isOnErrorPage = !router || router.pathname === '/404' || router.pathname === '/_error';
switch(message.type){
case HMR_MESSAGE_SENT_TO_BROWSER.RELOAD_PAGE:
{
sendMessage(JSON.stringify({
event: 'client-reload-page',
clientId: window.__nextDevClientId
}));
reloading = true;
return window.location.reload();
}
case HMR_MESSAGE_SENT_TO_BROWSER.REMOVED_PAGE:
{
const [page] = message.data;
// Check if the removed page is the current page
const isCurrentPage = page === router?.pathname;
// We enter here if the removed page is currently being viewed
// or if we happen to be on an error page.
if (isCurrentPage || isOnErrorPage) {
sendMessage(JSON.stringify({
event: 'client-removed-page',
clientId: window.__nextDevClientId,
page
}));
return window.location.reload();
}
return;
}
case HMR_MESSAGE_SENT_TO_BROWSER.ADDED_PAGE:
{
const [page] = message.data;
// Check if the added page is the current page
const isCurrentPage = page === router?.pathname;
// Check if the page component is not yet loaded
const isPageNotLoaded = page !== null && typeof router?.components?.[page] === 'undefined';
// We enter this block if the newly added page is the one currently being viewed
// but hasn't been loaded yet, or if we're on an error page.
if (isCurrentPage && isPageNotLoaded || isOnErrorPage) {
sendMessage(JSON.stringify({
event: 'client-added-page',
clientId: window.__nextDevClientId,
page
}));
return window.location.reload();
}
return;
}
case HMR_MESSAGE_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE:
{
return;
}
default:
{
message;
}
}
});
return devClient;
});
//# sourceMappingURL=hot-middleware-client.js.map