@react-three/fiber 8.6.0 → 8.6.1

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.
@@ -1,11 +1,11 @@
1
- import * as React from 'react';
2
- import type { Options as ResizeOptions } from 'react-use-measure';
3
- import { RenderProps } from '../core';
4
- export interface Props extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
5
- children: React.ReactNode;
6
- fallback?: React.ReactNode;
7
- resize?: ResizeOptions;
8
- eventSource?: HTMLElement;
9
- eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
10
- }
11
- export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLCanvasElement>>;
1
+ import * as React from 'react';
2
+ import type { Options as ResizeOptions } from 'react-use-measure';
3
+ import { RenderProps } from '../core';
4
+ export interface Props extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
5
+ children: React.ReactNode;
6
+ fallback?: React.ReactNode;
7
+ resize?: ResizeOptions;
8
+ eventSource?: HTMLElement;
9
+ eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
10
+ }
11
+ export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLCanvasElement>>;
@@ -1,4 +1,4 @@
1
- import { UseBoundStore } from 'zustand';
2
- import { RootState } from '../core/store';
3
- import { EventManager } from '../core/events';
4
- export declare function createPointerEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
1
+ import { UseBoundStore } from 'zustand';
2
+ import { RootState } from '../core/store';
3
+ import { EventManager } from '../core/events';
4
+ export declare function createPointerEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
@@ -1090,8 +1090,10 @@ function createRenderer(_roots, _getEventPriority) {
1090
1090
  supportsHydration: false,
1091
1091
  noTimeout: -1,
1092
1092
  appendChildToContainer: (container, child) => {
1093
- if (!child) return;
1094
- const scene = container.getState().scene; // Link current root to the default scene
1093
+ if (!child) return; // Don't append to unmounted container
1094
+
1095
+ const scene = container.getState().scene;
1096
+ if (!scene.__r3f) return; // Link current root to the default scene
1095
1097
 
1096
1098
  scene.__r3f.root = container;
1097
1099
  appendChild(scene, child);
@@ -1101,8 +1103,11 @@ function createRenderer(_roots, _getEventPriority) {
1101
1103
  removeChild(container.getState().scene, child);
1102
1104
  },
1103
1105
  insertInContainerBefore: (container, child, beforeChild) => {
1104
- if (!child || !beforeChild) return;
1105
- insertBefore(container.getState().scene, child, beforeChild);
1106
+ if (!child || !beforeChild) return; // Don't append to unmounted container
1107
+
1108
+ const scene = container.getState().scene;
1109
+ if (!scene.__r3f) return;
1110
+ insertBefore(scene, child, beforeChild);
1106
1111
  },
1107
1112
  getRootHostContext: () => null,
1108
1113
  getChildHostContext: parentHostContext => parentHostContext,
@@ -1063,8 +1063,10 @@ function createRenderer(_roots, _getEventPriority) {
1063
1063
  supportsHydration: false,
1064
1064
  noTimeout: -1,
1065
1065
  appendChildToContainer: (container, child) => {
1066
- if (!child) return;
1067
- const scene = container.getState().scene; // Link current root to the default scene
1066
+ if (!child) return; // Don't append to unmounted container
1067
+
1068
+ const scene = container.getState().scene;
1069
+ if (!scene.__r3f) return; // Link current root to the default scene
1068
1070
 
1069
1071
  scene.__r3f.root = container;
1070
1072
  appendChild(scene, child);
@@ -1074,8 +1076,11 @@ function createRenderer(_roots, _getEventPriority) {
1074
1076
  removeChild(container.getState().scene, child);
1075
1077
  },
1076
1078
  insertInContainerBefore: (container, child, beforeChild) => {
1077
- if (!child || !beforeChild) return;
1078
- insertBefore(container.getState().scene, child, beforeChild);
1079
+ if (!child || !beforeChild) return; // Don't append to unmounted container
1080
+
1081
+ const scene = container.getState().scene;
1082
+ if (!scene.__r3f) return;
1083
+ insertBefore(scene, child, beforeChild);
1079
1084
  },
1080
1085
  getRootHostContext: () => null,
1081
1086
  getChildHostContext: parentHostContext => parentHostContext,
@@ -1090,8 +1090,10 @@ function createRenderer(_roots, _getEventPriority) {
1090
1090
  supportsHydration: false,
1091
1091
  noTimeout: -1,
1092
1092
  appendChildToContainer: (container, child) => {
1093
- if (!child) return;
1094
- const scene = container.getState().scene; // Link current root to the default scene
1093
+ if (!child) return; // Don't append to unmounted container
1094
+
1095
+ const scene = container.getState().scene;
1096
+ if (!scene.__r3f) return; // Link current root to the default scene
1095
1097
 
1096
1098
  scene.__r3f.root = container;
1097
1099
  appendChild(scene, child);
@@ -1101,8 +1103,11 @@ function createRenderer(_roots, _getEventPriority) {
1101
1103
  removeChild(container.getState().scene, child);
1102
1104
  },
1103
1105
  insertInContainerBefore: (container, child, beforeChild) => {
1104
- if (!child || !beforeChild) return;
1105
- insertBefore(container.getState().scene, child, beforeChild);
1106
+ if (!child || !beforeChild) return; // Don't append to unmounted container
1107
+
1108
+ const scene = container.getState().scene;
1109
+ if (!scene.__r3f) return;
1110
+ insertBefore(scene, child, beforeChild);
1106
1111
  },
1107
1112
  getRootHostContext: () => null,
1108
1113
  getChildHostContext: parentHostContext => parentHostContext,
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-08c4a2bb.cjs.dev.js');
5
+ var index = require('./index-9a338808.cjs.dev.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-8826c241.cjs.prod.js');
5
+ var index = require('./index-f368ca4a.cjs.prod.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -1,5 +1,5 @@
1
- import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-cf0284c7.esm.js';
2
- export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from './index-cf0284c7.esm.js';
1
+ import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-cecf55e8.esm.js';
2
+ export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from './index-cecf55e8.esm.js';
3
3
  import _extends from '@babel/runtime/helpers/esm/extends';
4
4
  import * as React from 'react';
5
5
  import * as THREE from 'three';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-08c4a2bb.cjs.dev.js');
5
+ var index = require('../../dist/index-9a338808.cjs.dev.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-8826c241.cjs.prod.js');
5
+ var index = require('../../dist/index-f368ca4a.cjs.prod.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -1,5 +1,5 @@
1
- import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-cf0284c7.esm.js';
2
- export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from '../../dist/index-cf0284c7.esm.js';
1
+ import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-cecf55e8.esm.js';
2
+ export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from '../../dist/index-cecf55e8.esm.js';
3
3
  import _extends from '@babel/runtime/helpers/esm/extends';
4
4
  import * as React from 'react';
5
5
  import * as THREE from 'three';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/fiber",
3
- "version": "8.6.0",
3
+ "version": "8.6.1",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",