hunk.code_window: 			setWidth(scrollRef.current.offsetWidth);
   		}
   	}
   	// Resize view on initial render
   	useEffect(() => handleWindowResize(), []);
   	// Resize view on window resize
   	useOnWindowResize(handleWindowResize);
   	// Resize view on item selection/deselection
  
hunk.labels: keep keep keep keep replace replace keep keep keep keep keep
hunk.after_edit: 	// Resize view on initial render and reset selected item
   	useEffect(() => {
   		handleWindowResize();
   		getExplorerStore().selectedRowIndex = -1;
   		return () => {
   			getExplorerStore().selectedRowIndex = -1;
   		};
   	}, []);
  
hunk.file_path: interface/app/$libraryId/Explorer/MediaView.tsx
hunk.type: replace
file: import compression from 'compression';
  import express from 'express';
  import { renderPage } from 'vite-plugin-ssr';
  
  const isProduction = process.env.NODE_ENV === 'production';
  const root = `${__dirname}/..`;
  
  startServer();
  
  async function startServer() {
  	const app = express();
  
  	app.use(compression());
  
  	if (isProduction) {
  		const sirv = require('sirv');
  		app.use(sirv(`${root}/dist/client`));
  	} else {
  		const vite = require('vite');
  		const viteDevMiddleware = (
  			await vite.createServer({
  				root,
  				server: { middlewareMode: true }
  			})
  		).middlewares;
  		app.use(viteDevMiddleware);
  	}
  
  	app.get('*', async (req, res, next) => {
  		const url = req.originalUrl;
  		const pageContextInit = {
  			urlOriginal: url
  		};
  		const pageContext = await renderPage(pageContextInit);
  		const { httpResponse } = pageContext;
  		if (!httpResponse) return next();
  		const { body, statusCode, contentType } = httpResponse;
  		res.status(statusCode).type(contentType).send(body);
  	});
  
  	const port = process.env.PORT || 3000;
  	// @ts-ignore: I don't get why this isn't valid they have a definition matching this.
  	app.listen(port, '0.0.0.0');
  	console.log(`Server running at http://localhost:${port}`);
  }
  