mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Optimize loading controller and view
This commit is contained in:
parent
7c96c386c2
commit
2094a7a8c2
1 changed files with 6 additions and 4 deletions
|
@ -16,6 +16,7 @@ export interface ViewManagerPageProps {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page component that renders legacy views via the ViewManager.
|
* Page component that renders legacy views via the ViewManager.
|
||||||
|
* NOTE: Any new pages should use the generic Page component instead.
|
||||||
*/
|
*/
|
||||||
const ViewManagerPage: FunctionComponent<ViewManagerPageProps> = ({
|
const ViewManagerPage: FunctionComponent<ViewManagerPageProps> = ({
|
||||||
controller,
|
controller,
|
||||||
|
@ -30,10 +31,11 @@ const ViewManagerPage: FunctionComponent<ViewManagerPageProps> = ({
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadPage = async () => {
|
const loadPage = async () => {
|
||||||
const controllerFactory = await import(/* webpackChunkName: "[request]" */ `../../controllers/${controller}`);
|
const [ controllerFactory, viewHtml ] = await Promise.all([
|
||||||
|
import(/* webpackChunkName: "[request]" */ `../../controllers/${controller}`),
|
||||||
let viewHtml = await import(/* webpackChunkName: "[request]" */ `../../controllers/${view}`);
|
import(/* webpackChunkName: "[request]" */ `../../controllers/${view}`)
|
||||||
viewHtml = globalize.translateHtml(viewHtml);
|
.then(html => globalize.translateHtml(html))
|
||||||
|
]);
|
||||||
|
|
||||||
const viewOptions = {
|
const viewOptions = {
|
||||||
url: location.pathname + location.search,
|
url: location.pathname + location.search,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue