From 5578a96604dd59f172d19ccdf675a4e1fa91fa00 Mon Sep 17 00:00:00 2001 From: Stephen Date: Sun, 4 Oct 2026 20:03:53 -0700 Subject: [PATCH] debugging e2e issue --- package.json | 2 +- src/main/universe/index.tsx | 87 ++----------------------------------- 2 files changed, 4 insertions(+), 85 deletions(-) diff --git a/package.json b/package.json index f622ce1..03883f8 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "test:watch": "eslint --fix && jest --updateSnapshot --watchAll" }, "types": "dist/index.d.ts", - "version": "1.1.0-alpha.15", + "version": "1.1.0-alpha.16", "dependencies": { "@webkrafters/eagleeye": "^1.0.8", "js-sha512": "^0.9.0", diff --git a/src/main/universe/index.tsx b/src/main/universe/index.tsx index 26eef7d..1a48181 100644 --- a/src/main/universe/index.tsx +++ b/src/main/universe/index.tsx @@ -9,8 +9,7 @@ import { useState, useEffect, useMemo, - useRef, - Component + useRef } from 'react'; import isPlainObject from 'lodash.isplainobject'; @@ -147,7 +146,7 @@ class StreamerHandle implements Handle { return this._entry?.channel?.deref?.() as W } // istanbul ignore next - get size() { return this.isValid ? this._entry.numConnections : -1 } + get size() { return this.isValid ? this._entry.numConnections : 0 } // istanbul ignore next dec() { if( !this.isValid ) { return } @@ -410,15 +409,7 @@ export class ObservableUniverse { } else { mounted.current = true; } - const fn = () => { - try { setStore({ ...store, data: channel.data }) } catch( e ) { - /* allow system gc to clean up scheduled freed streams */ - /* istanbul ignore next */ - if( !( e as Error ).message.includes( - "Cannot read properties of null (reading 'getState')" - ) ) { throw e } - } - } + const fn = () => setStore({ ...store, data: channel.data }); channel.addListener( 'data-changed', fn ); return () => { channel.removeListener( 'data-changed', fn ); @@ -428,78 +419,6 @@ export class ObservableUniverse { return store as Store; }; } - - // private defineStreamHook() { - // return ( selectorMap? : S ) => { - // const [ sMapHash, updateSMapHash ] = useState(() => this._util.hashSelectorMap( selectorMap )); - // useEffect(() => updateSMapHash( this._util.hashSelectorMap( selectorMap ) ), [ selectorMap ]); - // const targetId = use( this._context ); - // const currChannel = useRef( null as unknown as Channel ); - // const currHandle = useRef( null as unknown as StreamerHandle> ); - // const currUpdater = useRef( null as unknown as () => void ); - // const handle = useMemo(() => { - // const ctxHandle = this._obs.createHandleFor( targetId ); - // let streamHandle = ctxHandle.getChannelHandleAt( sMapHash ); - // if( !streamHandle.isValid ) { - // ctxHandle.addChannelAt( - // sMapHash, ctxHandle.resource.stream( selectorMap ) - // ); - // streamHandle = ctxHandle.getChannelHandleAt( sMapHash ); - // } - // streamHandle.inc(); - // return streamHandle as StreamerHandle>; - // }, [ sMapHash, targetId ]); - - // let [ store, setStore ] = useState>(); - - // if( handle.resource !== currChannel.current ) { - // if( !!currChannel.current ) { - // currChannel.current.removeListener( - // 'data-changed', currUpdater.current - // ); - // currHandle.current.dec(); - // } - // store = makeStore( handle.resource ); - // currChannel.current = handle.resource; - // currHandle.current = handle; - // currUpdater.current = () => { - // // try { - // setStore({ ...store, data: currChannel.current.data }); - // // } catch( e ) { - // // /* istanbul ignore next */ - // // if( !( e as Error ).message.includes( - // // "Cannot read properties of null (reading 'getState')" - // // ) ) { throw e } - // // // allow system gc to clean up scheduled freed streams - // // } - // } - // } - - // // useEffect(() => { - // // setStore( makeStore( handle.resource ) ); - // // return handle.dec.bind( handle ); - // // }, [ handle.resource ] ) - // // useEffect(() => { - // // const fn = () => { - // // try { - // // setStore( makeStore( handle.resource ) ); - // // } catch( e ) { - // // /* istanbul ignore next */ - // // if( !( e as Error ).message.includes( - // // "Cannot read properties of null (reading 'getState')" - // // ) ) { throw e } - // // // allow system gc to clean up scheduled freed streams - // // } - // // } - // // handle.resource.addListener( 'data-changed', fn ); - // // return () => { - // // handle.resource.removeListener( 'data-changed', fn ); - // // } - // // }, [ handle.resource ]); - - // return store as Store; - // }; - // } } export class Utility {