You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provider is not updated by updationg providerFactory.
This behavior caused by this line.
The expected behavior
Provider can be updated when providerFactory is updated.
The problem I hit
I want to update providerFactory every time when id token is updated to prevent connection lost.
So I write the code like below.
constMyCollaborationPlugin=()=>{constidToken=useIdToken();// This function updates triggered by update of token.constproviderFactoryFunction=useCallback((id: string,yjsDocMap: Map<string,Doc>)=>{constdoc=getDocFromMap(id,yjsDocMap);returnnewWebsocketProvider('wss://test.com',id,doc,{connect: false,params: {id_token: idToken,item_id: id,},});},[idToken],);return<CollaborationPluginproviderFactory={providerFactoryFunction}id="dummyId"shouldBootstrap={true}/>;};
However, lexical implementation looks like preventing update provider. So I want to remove the line if it is possible.
Impact of fix
In the current implementation, if the ID token is updated after the WebSocket connection has been established and the connection is subsequently lost, the providerFactory isn’t updated.
As a result, the query parameter for the ID token remains outdated, preventing the connection from being re-established. With solving this issue, updating the ID token will allow the connection to be restored.
The text was updated successfully, but these errors were encountered:
I found the way to bypass regeneration of provider factory.
I forked y-websocket and changed the behavior of its onClose function to refetch the idToken when it reconnects.
websocket.onclose=async(event)=>{// ...if(provider.shouldConnect){// Fetch new id token when WebSocket disconnects.consttoken=awaitfetchAuthToken();if(token){provider.params={
...provider.params,id_token: token,};}setTimeout((provider)=>{setupWS(provider);},math.min(math.pow(2,provider.wsUnsuccessfulReconnects)*100,provider.maxBackoffTime),provider,);}};
Lexical version: 0.23.1
Steps To Reproduce
The current behavior
Provider is not updated by updationg providerFactory.
This behavior caused by this line.
The expected behavior
Provider can be updated when providerFactory is updated.
The problem I hit
I want to update providerFactory every time when id token is updated to prevent connection lost.
So I write the code like below.
However, lexical implementation looks like preventing update provider. So I want to remove the line if it is possible.
Impact of fix
In the current implementation, if the ID token is updated after the WebSocket connection has been established and the connection is subsequently lost, the providerFactory isn’t updated.
As a result, the query parameter for the ID token remains outdated, preventing the connection from being re-established. With solving this issue, updating the ID token will allow the connection to be restored.
The text was updated successfully, but these errors were encountered: