File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ const script = `(function () {
4747 });
4848})();` ;
4949
50- export function StaleAssetRecovery ( ) {
51- if ( process . env . NODE_ENV !== "production" ) {
50+ export function StaleAssetRecovery ( { isProduction } : { isProduction : boolean } ) {
51+ if ( ! isProduction ) {
5252 return null ;
5353 }
5454
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ import { getUser } from "./services/session.server";
1919import { getTimezonePreference } from "./services/preferences/uiPreferences.server" ;
2020import { appEnvTitleTag } from "./utils" ;
2121
22+ // Derived here (not inside StaleAssetRecovery) so the shared component takes
23+ // the flag as a prop. NODE_ENV is statically replaced in browser bundles, and
24+ // the ErrorBoundary can't rely on loader data.
25+ const isProduction = process . env . NODE_ENV === "production" ;
26+
2227export const links : LinksFunction = ( ) => {
2328 return [ { rel : "stylesheet" , href : tailwindStylesheetUrl } ] ;
2429} ;
@@ -98,7 +103,7 @@ export function ErrorBoundary() {
98103 < head >
99104 < meta charSet = "utf-8" />
100105
101- < StaleAssetRecovery />
106+ < StaleAssetRecovery isProduction = { isProduction } />
102107 < Meta />
103108 < Links />
104109 </ head >
@@ -125,7 +130,7 @@ export default function App() {
125130 < >
126131 < html lang = "en" className = "h-full" >
127132 < head >
128- < StaleAssetRecovery />
133+ < StaleAssetRecovery isProduction = { isProduction } />
129134 < Meta />
130135 < Links />
131136 </ head >
You can’t perform that action at this time.
0 commit comments