Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid some counter-productive lazy loaded files #7381

Merged
merged 9 commits into from
Jan 22, 2024
2 changes: 1 addition & 1 deletion eslint-local-rules/persistBackgroundData.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
./src/components/logViewer/logViewerTypes.ts
./src/components/Markdown.tsx
./src/components/MarkdownInline.tsx
./src/components/MarkdownLazy.tsx
./src/components/Markdown.tsx
./src/components/quickBar/defaultActions.tsx
./src/components/quickBar/QuickBarApp.tsx
./src/components/quickBar/quickBarRegistry.ts
Expand Down
20 changes: 0 additions & 20 deletions src/__mocks__/@/components/MarkdownInlineLazy.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions src/__mocks__/@/components/MarkdownLazy.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/bricks/renderers/MarkdownRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { RendererABC } from "@/types/bricks/rendererTypes";
import { propertiesToSchema } from "@/validators/generic";
import { validateRegistryId } from "@/types/helpers";
import MarkdownLazy from "@/components/MarkdownLazy";
import MarkdownLazy from "@/components/Markdown";
import { type BrickArgs, type ComponentRef } from "@/types/runtimeTypes";
import { ADD_IFRAME_CONFIG } from "@/utils/sanitize";

Expand Down
7 changes: 1 addition & 6 deletions src/bricks/transformers/selectElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { userSelectElement } from "@/contentScript/pageEditor/elementPicker";
import { TransformerABC } from "@/types/bricks/transformerTypes";
import { type Schema } from "@/types/schemaTypes";
import { propertiesToSchema } from "@/validators/generic";
Expand Down Expand Up @@ -53,11 +53,6 @@ export class SelectElement extends TransformerABC {
);

async transform(): Promise<unknown> {
// Include here to avoid error during header generation (which runs in node environment)
const { userSelectElement } = await import(
/* webpackChunkName: "editorContentScript" */ "@/contentScript/pageEditor/elementPicker"
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also dropping this for the same reason. This is actually how I ended up on this comment, via awesome-webextension/webpack-target-webextension#42 (comment)


const { elements } = await userSelectElement();

const elementRefs = elements.map((element) =>
Expand Down
35 changes: 0 additions & 35 deletions src/components/MarkdownInlineLazy.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions src/components/MarkdownLazy.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/formBuilder/DescriptionField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import React from "react";
import { type Field } from "@rjsf/utils";
import cx from "classnames";
import MarkdownLazy from "@/components/MarkdownLazy";
import MarkdownLazy from "@/components/Markdown";

type FormPreviewDescriptionFieldProps = {
description: string | React.ReactElement;
Expand Down
2 changes: 1 addition & 1 deletion src/components/formBuilder/DescriptionFieldTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import React from "react";
import cx from "classnames";
import MarkdownLazy from "@/components/MarkdownLazy";
import MarkdownLazy from "@/components/Markdown";

type FormPreviewDescriptionFieldProps = {
id: string;
Expand Down
4 changes: 2 additions & 2 deletions src/components/schemaTree/SchemaTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
} from "@fortawesome/free-solid-svg-icons";
import cx from "classnames";
import { isServiceField } from "@/components/fields/schemaFields/fieldTypeCheckers";
import MarkdownInlineLazy from "@/components/MarkdownInlineLazy";
import MarkdownInline from "@/components/MarkdownInline";

type SchemaTreeRow = {
name: string;
Expand Down Expand Up @@ -76,7 +76,7 @@ const DescriptionCell: React.FunctionComponent<{
row: Row & { values: SchemaTreeRow };
}> = ({ row }) =>
row.values.description ? (
<MarkdownInlineLazy
<MarkdownInline
markdown={row.values.description}
sanitizeConfig={DESCRIPTION_ALLOWED_TAGS}
as="span"
Expand Down
4 changes: 0 additions & 4 deletions src/tsconfig.strictNullChecks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
},
"files": [
"./__mocks__/@/components/DelayedRender.tsx",
"./__mocks__/@/components/MarkdownInlineLazy.tsx",
"./__mocks__/@/components/MarkdownLazy.tsx",
"./__mocks__/@/hooks/useContextInvalidated.ts",
"./__mocks__/@/icons/getSvgIcon.ts",
"./__mocks__/@/icons/list.ts",
Expand Down Expand Up @@ -106,8 +104,6 @@
"./components/Loader.tsx",
"./components/Markdown.tsx",
"./components/MarkdownInline.tsx",
"./components/MarkdownInlineLazy.tsx",
"./components/MarkdownLazy.tsx",
"./components/ModalLayout.tsx",
"./components/Stylesheets.tsx",
"./components/TooltipIconButton.tsx",
Expand Down
Loading