@tscircuit/3d-viewer 0.0.346 → 0.0.347

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +9 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25582,7 +25582,7 @@ import * as THREE10 from "three";
25582
25582
  // package.json
25583
25583
  var package_default = {
25584
25584
  name: "@tscircuit/3d-viewer",
25585
- version: "0.0.345",
25585
+ version: "0.0.346",
25586
25586
  main: "./dist/index.js",
25587
25587
  module: "./dist/index.js",
25588
25588
  type: "module",
@@ -25846,6 +25846,13 @@ import {
25846
25846
  useMemo as useMemo8
25847
25847
  } from "react";
25848
25848
  import * as THREE7 from "three";
25849
+
25850
+ // src/react-three/remove-existing-canvases.ts
25851
+ function removeExistingCanvases(container) {
25852
+ container.querySelectorAll("canvas").forEach((existingCanvas) => existingCanvas.remove());
25853
+ }
25854
+
25855
+ // src/react-three/Canvas.tsx
25849
25856
  import { jsx as jsx9 } from "react/jsx-runtime";
25850
25857
  var Canvas = forwardRef(
25851
25858
  ({ children, scene: sceneProps, camera: cameraProps, style }, ref) => {
@@ -25878,6 +25885,7 @@ var Canvas = forwardRef(
25878
25885
  useImperativeHandle(ref, () => rootObject.current);
25879
25886
  useEffect10(() => {
25880
25887
  if (!mountRef.current) return;
25888
+ removeExistingCanvases(mountRef.current);
25881
25889
  const renderer = new THREE7.WebGLRenderer({ antialias: true, alpha: true });
25882
25890
  renderer.setSize(
25883
25891
  mountRef.current.clientWidth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.346",
3
+ "version": "0.0.347",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",