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

fix: Excalidraw named export type #5078

Merged
merged 1 commit into from Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/excalidraw-app/index.tsx
Expand Up @@ -19,7 +19,8 @@ import {
} from "../element/types";
import { useCallbackRefState } from "../hooks/useCallbackRefState";
import { Language, t } from "../i18n";
import Excalidraw, {
import {
Excalidraw,
defaultLang,
languages,
} from "../packages/excalidraw/index";
Expand Down
3 changes: 0 additions & 3 deletions src/packages/excalidraw/entry.js
@@ -1,6 +1,3 @@
import Excalidraw from "./index";

import "../../../public/fonts.css";

export { Excalidraw };
export * from "./index";
8 changes: 5 additions & 3 deletions src/packages/excalidraw/index.tsx
Expand Up @@ -13,7 +13,7 @@ import { DEFAULT_UI_OPTIONS } from "../../constants";
import { Provider } from "jotai";
import { jotaiScope, jotaiStore } from "../../jotai";

const Excalidraw = (props: ExcalidrawProps) => {
const ExcalidrawBase = (props: ExcalidrawProps) => {
const {
onChange,
initialData,
Expand Down Expand Up @@ -173,8 +173,10 @@ const areEqual = (
const forwardedRefComp = forwardRef<
ExcalidrawAPIRefValue,
PublicExcalidrawProps
>((props, ref) => <Excalidraw {...props} excalidrawRef={ref} />);
export default React.memo(forwardedRefComp, areEqual);
>((props, ref) => <ExcalidrawBase {...props} excalidrawRef={ref} />);

export const Excalidraw = React.memo(forwardedRefComp, areEqual);

export {
getSceneVersion,
isInvisiblySmallElement,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/packages/excalidraw.test.tsx
@@ -1,5 +1,5 @@
import { fireEvent, GlobalTestState, render } from "../test-utils";
import Excalidraw from "../../packages/excalidraw/index";
import { Excalidraw } from "../../packages/excalidraw/index";
import { queryByText, queryByTestId } from "@testing-library/react";
import { GRID_SIZE, THEME } from "../../constants";
import { t } from "../../i18n";
Expand Down
2 changes: 1 addition & 1 deletion src/tests/scroll.test.tsx
Expand Up @@ -4,7 +4,7 @@ import {
restoreOriginalGetBoundingClientRect,
waitFor,
} from "./test-utils";
import Excalidraw from "../packages/excalidraw/index";
import { Excalidraw } from "../packages/excalidraw/index";
import { API } from "./helpers/api";

const { h } = window;
Expand Down