@react-three/rapier 1.1.1 → 1.1.2

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.
@@ -571,7 +571,9 @@ const useMutableCallback = fn => {
571
571
 
572
572
 
573
573
  const useRapier = () => {
574
- return React.useContext(rapierContext);
574
+ const rapier = React.useContext(rapierContext);
575
+ if (!rapier) throw new Error('react-three-rapier: useRapier must be used within <Physics />!');
576
+ return rapier;
575
577
  };
576
578
  /**
577
579
  * Registers a callback to be called before the physics step
@@ -571,7 +571,9 @@ const useMutableCallback = fn => {
571
571
 
572
572
 
573
573
  const useRapier = () => {
574
- return React.useContext(rapierContext);
574
+ const rapier = React.useContext(rapierContext);
575
+ if (!rapier) throw new Error('react-three-rapier: useRapier must be used within <Physics />!');
576
+ return rapier;
575
577
  };
576
578
  /**
577
579
  * Registers a callback to be called before the physics step
@@ -546,7 +546,9 @@ const useMutableCallback = fn => {
546
546
 
547
547
 
548
548
  const useRapier = () => {
549
- return useContext(rapierContext);
549
+ const rapier = useContext(rapierContext);
550
+ if (!rapier) throw new Error('react-three-rapier: useRapier must be used within <Physics />!');
551
+ return rapier;
550
552
  };
551
553
  /**
552
554
  * Registers a callback to be called before the physics step
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/rapier",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/react-three-rapier.cjs.js",
6
6
  "module": "dist/react-three-rapier.esm.js",
@@ -12,10 +12,10 @@
12
12
  "devDependencies": {
13
13
  "@react-three/drei": "9.74.14",
14
14
  "@react-three/fiber": "8.9.1",
15
- "@react-three/test-renderer": "8.0.17",
15
+ "@react-three/test-renderer": "8.1.5",
16
16
  "@types/react-dom": "18.0.2",
17
17
  "@types/three": "^0.152.1",
18
- "@vitejs/plugin-react": "^2.1.0",
18
+ "@vitejs/plugin-react": "^4.0.3",
19
19
  "@vitest/ui": "0.32.0",
20
20
  "happy-dom": "9.19.2",
21
21
  "react": "18.2.0",