From 4ed90faf792bbf04360d2048a0c98f59abb187f3 Mon Sep 17 00:00:00 2001 From: Dmitry S Date: Fri, 9 Aug 2024 14:20:08 -0400 Subject: [PATCH] (core) Fix more tests: bundleSize and Embed Summary: 1. Unclear why Embed fails often. Locally, it fails for me every time, and this tweak makes it pass (while still keeping the test useful). 2. Reduced back main bundle's size by removing dependency of some common elements on the full AdminPanel. Updated expected size of errorPages bundle to the new reduced size. Test Plan: No changes to functionality; relying on existing tests to verify that. Reviewers: jordigh Reviewed By: jordigh Subscribers: georgegevoian, jordigh Differential Revision: https://phab.getgrist.com/D4315 --- app/client/ui/AccountWidget.ts | 2 +- app/client/ui/AdminPanel.ts | 6 +----- app/client/ui/AdminPanelName.ts | 11 +++++++++++ app/client/ui/HomeLeftPane.ts | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 app/client/ui/AdminPanelName.ts diff --git a/app/client/ui/AccountWidget.ts b/app/client/ui/AccountWidget.ts index 10723e1a..3a968a56 100644 --- a/app/client/ui/AccountWidget.ts +++ b/app/client/ui/AccountWidget.ts @@ -1,7 +1,7 @@ import {AppModel} from 'app/client/models/AppModel'; import {DocPageModel} from 'app/client/models/DocPageModel'; import {getLoginOrSignupUrl, getLoginUrl, getLogoutUrl, getSignupUrl, urlState} from 'app/client/models/gristUrlState'; -import {getAdminPanelName} from 'app/client/ui/AdminPanel'; +import {getAdminPanelName} from 'app/client/ui/AdminPanelName'; import {manageTeamUsers} from 'app/client/ui/OpenUserManager'; import {createUserImage} from 'app/client/ui/UserImage'; import * as viewport from 'app/client/ui/viewport'; diff --git a/app/client/ui/AdminPanel.ts b/app/client/ui/AdminPanel.ts index c0bb0682..ae1fa8ef 100644 --- a/app/client/ui/AdminPanel.ts +++ b/app/client/ui/AdminPanel.ts @@ -25,14 +25,10 @@ import * as version from 'app/common/version'; import {Computed, Disposable, dom, IDisposable, IDisposableOwner, MultiHolder, Observable, styled} from 'grainjs'; import {AdminSection, AdminSectionItem, HidableToggle} from 'app/client/ui/AdminPanelCss'; +import {getAdminPanelName} from 'app/client/ui/AdminPanelName'; const t = makeT('AdminPanel'); -// Translated "Admin Panel" name, made available to other modules. -export function getAdminPanelName() { - return t("Admin Panel"); -} - export class AdminPanel extends Disposable { private _supportGrist = SupportGristPage.create(this, this._appModel); private _toggleEnterprise = ToggleEnterpriseWidget.create(this); diff --git a/app/client/ui/AdminPanelName.ts b/app/client/ui/AdminPanelName.ts new file mode 100644 index 00000000..cd946d21 --- /dev/null +++ b/app/client/ui/AdminPanelName.ts @@ -0,0 +1,11 @@ +// Separated out into its own file because this is used in several modules, but we'd like to avoid +// pulling in the full AdminPanel into their bundle. + +import {makeT} from 'app/client/lib/localization'; + +const t = makeT('AdminPanel'); + +// Translated "Admin Panel" name, made available to other modules. +export function getAdminPanelName() { + return t("Admin Panel"); +} diff --git a/app/client/ui/HomeLeftPane.ts b/app/client/ui/HomeLeftPane.ts index 895933f7..1489b6ab 100644 --- a/app/client/ui/HomeLeftPane.ts +++ b/app/client/ui/HomeLeftPane.ts @@ -5,7 +5,7 @@ import {reportError} from 'app/client/models/AppModel'; import {docUrl, urlState} from 'app/client/models/gristUrlState'; import {HomeModel} from 'app/client/models/HomeModel'; import {getWorkspaceInfo, workspaceName} from 'app/client/models/WorkspaceInfo'; -import {getAdminPanelName} from 'app/client/ui/AdminPanel'; +import {getAdminPanelName} from 'app/client/ui/AdminPanelName'; import {addNewButton, cssAddNewButton} from 'app/client/ui/AddNewButton'; import {docImport, importFromPlugin} from 'app/client/ui/HomeImports'; import {