Repository: excalidraw/excalidraw
File: src/components/App.tsx (TypeScript)

Code before:
        }px)`,
      );
      const handler = () => {
        this.excalidrawContainerRef.current!.getBoundingClientRect();
        this.device = updateObject(this.device, {
          isSmScreen: smScreenQuery.matches,
          isMobile: mdScreenQuery.matches,
          canDeviceFitSidebar: canDeviceFitSidebarMediaQuery.matches,
        });
      };
      mdScreenQuery.addListener(handler);
      this.detachIsMobileMqHandler = () =>
        mdScreenQuery.removeListener(handler);
    }

    const searchParams = new URLSearchParams(window.location.search.slice(1));

    if (searchParams.has("web-share-target")) {
      // Obtain a file that was shared via the Web Share Target API.
      this.restoreFileFromShare();
    } else {
      this.updateDOMRect(this.initializeScene);
    }
    if (isBrave() && !isMeasureTextSupported()) {
      this.setState({
        errorMessage: <BraveMeasureTextError />,
      });
    }
  }

  public componentWillUnmount() {
    this.files = {};
    this.imageCache.clear();
    this.resizeObserver?.disconnect();
    this.unmounted = true;
    this.removeEventListeners();
    this.scene.destroy();
    clearTimeout(touchTimeout);
    touchTimeout = 0;
  }

  private onResize = withBatchedUpdates(() => {
    this.scene
      .getElementsIncludingDeleted()
      .forEach((element) => invalidateShapeForElement(element));
    this.setState({});
  });

  private removeEventListeners() {
    document.removeEventListener(EVENT.POINTER_UP, this.removePointer);
    document.removeEventListener(EVENT.COPY, this.onCopy);

Review comment (suggestion):
```suggestion

    // note that this check seems to always pass in localhost
    if (isBrave() && !isMeasureTextSupported()) {
```

Code after:
        }px)`,
      );
      const handler = () => {
        this.excalidrawContainerRef.current!.getBoundingClientRect();
        this.device = updateObject(this.device, {
          isSmScreen: smScreenQuery.matches,
          isMobile: mdScreenQuery.matches,
          canDeviceFitSidebar: canDeviceFitSidebarMediaQuery.matches,
        });
      };
      mdScreenQuery.addListener(handler);
      this.detachIsMobileMqHandler = () =>
        mdScreenQuery.removeListener(handler);
    }

    const searchParams = new URLSearchParams(window.location.search.slice(1));

    if (searchParams.has("web-share-target")) {
      // Obtain a file that was shared via the Web Share Target API.
      this.restoreFileFromShare();
    } else {
      this.updateDOMRect(this.initializeScene);
    }

    // note that this check seems to always pass in localhost
    if (isBrave() && !isMeasureTextSupported()) {
      this.setState({
        errorMessage: <BraveMeasureTextError />,
      });
    }
  }

  public componentWillUnmount() {
    this.files = {};
    this.imageCache.clear();
    this.resizeObserver?.disconnect();
    this.unmounted = true;
    this.removeEventListeners();
    this.scene.destroy();
    clearTimeout(touchTimeout);
    touchTimeout = 0;
  }

  private onResize = withBatchedUpdates(() => {
    this.scene
      .getElementsIncludingDeleted()
      .forEach((element) => invalidateShapeForElement(element));
    this.setState({});
  });

  private removeEventListeners() {