feat: enhance image loading and socket handling in Product and Images components, and update prerender logic in App and ProductDetailPage
This commit is contained in:
@@ -178,11 +178,16 @@ const renderPage = (
|
||||
const prerenderFallbackScript = `
|
||||
<script>
|
||||
// Save prerendered content to window object for SocketProvider fallback
|
||||
window.__PRERENDER_FALLBACK__ = {
|
||||
window.__PRERENDER_FALLBACK__ = {
|
||||
path: '${location}',
|
||||
content: ${JSON.stringify(renderedMarkup)},
|
||||
timestamp: ${Date.now()}
|
||||
};
|
||||
|
||||
// DEBUG: Multiple alerts throughout the loading process
|
||||
// Debug alerts removed
|
||||
|
||||
|
||||
</script>
|
||||
`;
|
||||
|
||||
@@ -239,8 +244,10 @@ const renderPage = (
|
||||
|
||||
let newHtml;
|
||||
if (rootDivRegex.test(template)) {
|
||||
if (!suppressLogs) console.log(` 📝 Root div found, replacing with ${renderedMarkup.length} chars of markup`);
|
||||
newHtml = template.replace(rootDivRegex, replacementHtml);
|
||||
} else {
|
||||
if (!suppressLogs) console.log(` ⚠️ No root div found, appending to body`);
|
||||
newHtml = template.replace("<body>", `<body>${replacementHtml}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user