fix: wrong token being passed in the read-only editor (#5954)

* fix: wrong token

* chore: update useMemo dependencies
This commit is contained in:
Aaryan Khandelwal 2024-11-05 17:45:53 +05:30 committed by GitHub
parent ea8583b2d4
commit bb311b750f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,7 +32,7 @@ export const useReadOnlyCollaborativeEditor = (props: TReadOnlyCollaborativeEdit
new HocuspocusProvider({
url: realtimeConfig.url,
name: id,
token: user.id,
token: JSON.stringify(user),
parameters: realtimeConfig.queryParams,
onAuthenticationFailed: () => {
serverHandler?.onServerError?.();
@ -47,7 +47,7 @@ export const useReadOnlyCollaborativeEditor = (props: TReadOnlyCollaborativeEdit
},
onSynced: () => setHasServerSynced(true),
}),
[id, realtimeConfig, user.id]
[id, realtimeConfig, user]
);
// destroy and disconnect connection on unmount
useEffect(