New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@0g/react

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0g/react - npm Package Compare versions

Comparing version 3.0.4 to 4.0.0

dist/hooks/internal.d.ts

2

dist/hooks/useQuery.d.ts
import { QueryComponentFilter } from '0g';
export declare function useQuery(queryDef: QueryComponentFilter): readonly number[];
export declare function useQuery(queryDef: QueryComponentFilter): import("0g").Query<QueryComponentFilter>;

@@ -1,2 +0,2 @@

import { useLayoutEffect, useState } from 'react';
import { useState, useSyncExternalStore } from 'react';
import { useGame } from './useGame.js';

@@ -7,10 +7,6 @@ export function useQuery(queryDef) {

const [query] = useState(() => game.queryManager.create(queryDef));
const [_, setForceUpdate] = useState(Math.random());
useLayoutEffect(() => {
function onEntitiesChanged() {
setForceUpdate(Math.random());
}
useSyncExternalStore((onChange) => {
const cleanup = [
query.subscribe('entityAdded', onEntitiesChanged),
query.subscribe('entityRemoved', onEntitiesChanged),
query.subscribe('entityAdded', onChange),
query.subscribe('entityRemoved', onChange),
];

@@ -22,5 +18,5 @@ return () => {

};
}, [query]);
return query.entities;
}, () => query.generation);
return query;
}
//# sourceMappingURL=useQuery.js.map
{
"name": "@0g/react",
"version": "3.0.4",
"version": "4.0.0",
"description": "",

@@ -35,3 +35,3 @@ "type": "module",

"peerDependencies": {
"0g": "0.3.4",
"0g": "0.4.0",
"react": "^18.0.0"

@@ -47,3 +47,3 @@ },

"typescript": "5.4.5",
"0g": "0.3.4"
"0g": "0.4.0"
},

@@ -50,0 +50,0 @@ "dependencies": {},

@@ -1,2 +0,2 @@

import { useLayoutEffect, useState } from 'react';
import { useState, useSyncExternalStore } from 'react';
import { QueryComponentFilter } from '0g';

@@ -9,22 +9,20 @@ import { useGame } from './useGame.js';

const [query] = useState(() => game.queryManager.create(queryDef));
const [_, setForceUpdate] = useState(Math.random());
useLayoutEffect(() => {
function onEntitiesChanged() {
setForceUpdate(Math.random());
}
useSyncExternalStore(
(onChange) => {
const cleanup = [
query.subscribe('entityAdded', onChange),
query.subscribe('entityRemoved', onChange),
];
const cleanup = [
query.subscribe('entityAdded', onEntitiesChanged),
query.subscribe('entityRemoved', onEntitiesChanged),
];
return () => {
for (const unsub of cleanup) {
unsub();
}
};
},
() => query.generation,
);
return () => {
for (const unsub of cleanup) {
unsub();
}
};
}, [query]);
return query.entities;
return query;
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc