perf: json

This commit is contained in:
cha0s 2024-07-21 07:28:22 -05:00
parent 14713797f1
commit d0252bc9ff

View File

@ -16,12 +16,12 @@ export default function Devtools({
}) { }) {
const [ecs] = useEcs(); const [ecs] = useEcs();
const [mainEntity] = useMainEntity(); const [mainEntity] = useMainEntity();
const [mainEntityJson, setMainEntityJson] = useState({}); const [mainEntityJson, setMainEntityJson] = useState('');
useEcsTick(() => { useEcsTick(() => {
if (!ecs || !mainEntity) { if (!ecs || !mainEntity) {
return; return;
} }
setMainEntityJson(ecs.get(mainEntity).toJSON()); setMainEntityJson(JSON.stringify(ecs.get(mainEntity), null, 2));
}, [ecs, mainEntity]); }, [ecs, mainEntity]);
return ( return (
<div className={styles.devtools}> <div className={styles.devtools}>
@ -46,7 +46,7 @@ export default function Devtools({
</label> </label>
</div> </div>
</form> </form>
<pre><code><small>{JSON.stringify(mainEntityJson, null, 2)}</small></code></pre> <pre><code><small>{mainEntityJson}</small></code></pre>
</div> </div>
</TabPanel> </TabPanel>
<TabPanel> <TabPanel>