Add preloader and disable service worker to prevent blank screen issues
Introduces a visual preloader to the client's index.html and disables the service worker in main.tsx. Additionally, server-side middleware in index.ts is added to set no-cache headers for HTML pages, aiming to resolve the reported blank screen problem. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 890577b1-c154-40a4-a177-a0c6d55320c3 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/890577b1-c154-40a4-a177-a0c6d55320c3/DyHCx4q
This commit is contained in:
@@ -10,6 +10,19 @@ const app = express();
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: false }));
|
||||
|
||||
// Prevent caching issues middleware
|
||||
app.use((req, res, next) => {
|
||||
// Set no-cache headers for HTML pages to prevent blank screen issues
|
||||
if (req.path === '/' || req.path.endsWith('.html') || !req.path.includes('.')) {
|
||||
res.set({
|
||||
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
||||
'Pragma': 'no-cache',
|
||||
'Expires': '0'
|
||||
});
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
app.use((req, res, next) => {
|
||||
const start = Date.now();
|
||||
const path = req.path;
|
||||
|
||||
Reference in New Issue
Block a user