There are some weird complexity with how WebSdkApi is initialized, resulting in 2 different forms of initialization that need to be handled by the app developer.
There should only be one route for initialization, such that the developer only needs a single if/else conditional to distinguish between holo & holochain login (i.e it should be this #104).
case 1: Agent State is defined beforeconst client = await WebSdkApi.connect() resolves. Thus the app can read the agent state via client.agentState.
case 2: Agent State is defined afterconst client = await WebSdkApi.connect() resolves. Thus the app must listen to emitted events to read the agent state via client.on('agent-state', (state) => {})
It's inconsistent which case will occur each time the client is initialized, and thus the developer must handle both cases, resulting in this unnecessarily complex bunch of code to setup a holo client:
There are some weird complexity with how WebSdkApi is initialized, resulting in 2 different forms of initialization that need to be handled by the app developer.
There should only be one route for initialization, such that the developer only needs a single if/else conditional to distinguish between holo & holochain login (i.e it should be this #104).
case 1: Agent State is defined before
const client = await WebSdkApi.connect()
resolves. Thus the app can read the agent state viaclient.agentState
.case 2: Agent State is defined after
const client = await WebSdkApi.connect()
resolves. Thus the app must listen to emitted events to read the agent state viaclient.on('agent-state', (state) => {})
It's inconsistent which case will occur each time the client is initialized, and thus the developer must handle both cases, resulting in this unnecessarily complex bunch of code to setup a holo client: