Skip to content

v2.0.3 #93

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

Merged
merged 4 commits into from
Jun 26, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spacesvr is actively maintained by [Muse](https://www.muse.place?utm_source=npmj

- [Visit the codesandbox](https://codesandbox.io/s/e9w29) to instantly play with the package
- [Clone the starter repo](https://github.com/spacesvr/spacesvr-starter) to start using with Next.js
- [Sign up for muse](www.muse.place?utm_source=npmjs&utm_campaign=no_code) to build using our no-code editor
- [Sign up for muse](https://www.muse.place?utm_source=npmjs&utm_campaign=no_code) to build using our no-code editor

## Develop

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spacesvr",
"version": "2.0.2",
"version": "2.0.3",
"private": true,
"description": "A standardized reality for future of the 3D Web",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/layers/Environment/ui/PauseMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function PauseMenu(props: PauseMenuProps) {
const PAUSE_ITEMS: PauseItem[] = [
...pauseMenuItems,
{
text: "v2.0.2",
text: "v2.0.3",
link: "https://www.npmjs.com/package/spacesvr",
},
...menuItems,
Expand Down
4 changes: 2 additions & 2 deletions src/layers/Network/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export function Network(props: NetworkLayerProps) {

// connect on start if autoconnect is enabled
useEffect(() => {
if (autoconnect && !connected) connect();
}, [autoconnect, connected]);
if (autoconnect) connect();
}, [autoconnect]);

// log status on changes
const lastVal = useRef(false);
Expand Down
2 changes: 1 addition & 1 deletion src/layers/Network/logic/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const useConnection = (
setPeer(undefined);
};

useWaving(0.75, signaller, disconnect);
useWaving(1, signaller, disconnect);

return {
connected,
Expand Down
14 changes: 7 additions & 7 deletions src/layers/Network/logic/wave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useRef } from "react";
import { ConnectionState } from "./connection";
import { Signaller } from "./signallers";

const MAX_TRIES = 3;
const MAX_TRIES = 4;

export const useWaving = (
minuteFrequency: number,
Expand All @@ -13,13 +13,13 @@ export const useWaving = (
) => {
const numFailed = useRef(0);

const limiter = useLimiter(1 / (minuteFrequency * 60));
const waveLimiter = useLimiter(1 / (minuteFrequency * 60));
const failLimiter = useLimiter(1 / 10);
useFrame(({ clock }) => {
if (
!singaller ||
!limiter.isReady(clock) ||
numFailed.current > MAX_TRIES
) {
if (!singaller || numFailed.current > MAX_TRIES) return;

const FAIL_STATE = numFailed.current > 0;
if (!(FAIL_STATE ? failLimiter : waveLimiter).isReady(clock)) {
return;
}

Expand Down