Fixed: Caching for dynamically loaded JS files Fixed: Incorrect caching of initialize.js (cherry picked from commit f0cb5b81f140c67fa84162e094cc4e0f3476f5da) Closes #2690 Closes #2696pull/2788/head
parent
e3247dc505
commit
7f25a3c4b1
@ -0,0 +1,21 @@
|
|||||||
|
import { createBrowserHistory } from 'history';
|
||||||
|
import React from 'react';
|
||||||
|
import { render } from 'react-dom';
|
||||||
|
import createAppStore from 'Store/createAppStore';
|
||||||
|
import { fetchTranslations } from 'Utilities/String/translate';
|
||||||
|
import App from './App/App';
|
||||||
|
|
||||||
|
export async function bootstrap() {
|
||||||
|
const history = createBrowserHistory();
|
||||||
|
const store = createAppStore(history);
|
||||||
|
const hasTranslationsError = !(await fetchTranslations());
|
||||||
|
|
||||||
|
render(
|
||||||
|
<App
|
||||||
|
store={store}
|
||||||
|
history={history}
|
||||||
|
hasTranslationsError={hasTranslationsError}
|
||||||
|
/>,
|
||||||
|
document.getElementById('root')
|
||||||
|
);
|
||||||
|
}
|
@ -1,26 +0,0 @@
|
|||||||
import { createBrowserHistory } from 'history';
|
|
||||||
import React from 'react';
|
|
||||||
import { render } from 'react-dom';
|
|
||||||
import { fetchTranslations } from 'Utilities/String/translate';
|
|
||||||
|
|
||||||
import './preload';
|
|
||||||
import './polyfills';
|
|
||||||
import 'Styles/globals.css';
|
|
||||||
import './index.css';
|
|
||||||
|
|
||||||
const history = createBrowserHistory();
|
|
||||||
const hasTranslationsError = !await fetchTranslations();
|
|
||||||
|
|
||||||
const { default: createAppStore } = await import('Store/createAppStore');
|
|
||||||
const { default: App } = await import('./App/App');
|
|
||||||
|
|
||||||
const store = createAppStore(history);
|
|
||||||
|
|
||||||
render(
|
|
||||||
<App
|
|
||||||
store={store}
|
|
||||||
history={history}
|
|
||||||
hasTranslationsError={hasTranslationsError}
|
|
||||||
/>,
|
|
||||||
document.getElementById('root')
|
|
||||||
);
|
|
@ -0,0 +1,19 @@
|
|||||||
|
import './polyfills';
|
||||||
|
import 'Styles/globals.css';
|
||||||
|
import './index.css';
|
||||||
|
|
||||||
|
const initializeUrl = `${
|
||||||
|
window.Readarr.urlBase
|
||||||
|
}/initialize.json?t=${Date.now()}`;
|
||||||
|
const response = await fetch(initializeUrl);
|
||||||
|
|
||||||
|
window.Readarr = await response.json();
|
||||||
|
|
||||||
|
/* eslint-disable no-undef, @typescript-eslint/ban-ts-comment */
|
||||||
|
// @ts-ignore 2304
|
||||||
|
__webpack_public_path__ = `${window.Readarr.urlBase}/`;
|
||||||
|
/* eslint-enable no-undef, @typescript-eslint/ban-ts-comment */
|
||||||
|
|
||||||
|
const { bootstrap } = await import('./bootstrap');
|
||||||
|
|
||||||
|
await bootstrap();
|
Loading…
Reference in new issue