[WIKI-722] fix: hocuspocus provider update to v3 (#7930)

* fix: hocuspocus provider

* fix: hocuspocus updated url instead of queryparams
This commit is contained in:
M. Palanikannan 2025-10-09 15:38:15 +05:30 committed by GitHub
parent 561ae82d9d
commit 98e0089723
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 17 deletions

View file

@ -152,10 +152,17 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
const isSecureEnvironment = window.location.protocol === "https:";
WS_LIVE_URL.protocol = isSecureEnvironment ? "wss" : "ws";
WS_LIVE_URL.pathname = `${LIVE_BASE_PATH}/collaboration`;
// Append query parameters to the URL
Object.entries(webhookConnectionParams)
.filter(([_, value]) => value !== undefined && value !== null)
.forEach(([key, value]) => {
WS_LIVE_URL.searchParams.set(key, String(value));
});
// Construct realtime config
return {
url: WS_LIVE_URL.toString(),
queryParams: webhookConnectionParams,
};
} catch (error) {
console.error("Error creating realtime config", error);

View file

@ -38,7 +38,7 @@
"@floating-ui/dom": "^1.7.1",
"@floating-ui/react": "^0.26.4",
"@headlessui/react": "^1.7.3",
"@hocuspocus/provider": "^2.15.0",
"@hocuspocus/provider": "3.2.5",
"@plane/constants": "workspace:*",
"@plane/hooks": "workspace:*",
"@plane/types": "workspace:*",

View file

@ -45,7 +45,6 @@ export const useCollaborativeEditor = (props: TCollaborativeEditorHookProps) =>
() =>
new HocuspocusProvider({
name: id,
parameters: realtimeConfig.queryParams,
// using user id as a token to verify the user on the server
token: JSON.stringify(user),
url: realtimeConfig.url,

View file

@ -42,7 +42,6 @@ export type TUserDetails = {
export type TRealtimeConfig = {
url: string;
queryParams: TWebhookConnectionQueryParams;
};
export type IMarking = {

19
pnpm-lock.yaml generated
View file

@ -715,8 +715,8 @@ importers:
specifier: ^1.7.3
version: 1.7.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@hocuspocus/provider':
specifier: ^2.15.0
version: 2.15.3(y-protocols@1.0.6(yjs@13.6.27))(yjs@13.6.27)
specifier: 3.2.5
version: 3.2.5(y-protocols@1.0.6(yjs@13.6.27))(yjs@13.6.27)
'@plane/constants':
specifier: workspace:*
version: link:../constants
@ -1912,9 +1912,6 @@ packages:
react: ^16 || ^17 || ^18
react-dom: ^16 || ^17 || ^18
'@hocuspocus/common@2.15.3':
resolution: {integrity: sha512-Rzh1HF0a2o/tf90A3w2XNdXd9Ym3aQzMDfD3lAUONCX9B9QOdqdyiORrj6M25QEaJrEIbXFy8LtAFcL0wRdWzA==}
'@hocuspocus/common@3.2.5':
resolution: {integrity: sha512-unodX1+dBUp2sink7nKg/PSNDDUjM+AyMxg3WGpRTZb1LI0z/22DjjwFCgWWvoCNQALPVp9PFB/wyAI0xNo6GA==}
@ -1932,8 +1929,8 @@ packages:
y-protocols: ^1.0.6
yjs: ^13.6.8
'@hocuspocus/provider@2.15.3':
resolution: {integrity: sha512-oadN05m+KL4ylNKVo5YspNG4MXkT2Y+FUFzrgigpQeTjQibkPUwCNmUnkUxMgrGRgxb+O0lJCfirFIJMxedctA==}
'@hocuspocus/provider@3.2.5':
resolution: {integrity: sha512-UZpmPYSp8T2ms1E049GayQcaUIVBAZCWiNIiuxfO/+lydTto8svqEgJVmIUqxmSJ3lO64zo9wsyQz9wXu2hlnQ==}
peerDependencies:
y-protocols: ^1.0.6
yjs: ^13.6.8
@ -9003,10 +9000,6 @@ snapshots:
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
'@hocuspocus/common@2.15.3':
dependencies:
lib0: 0.2.114
'@hocuspocus/common@3.2.5':
dependencies:
lib0: 0.2.114
@ -9043,9 +9036,9 @@ snapshots:
- supports-color
- utf-8-validate
'@hocuspocus/provider@2.15.3(y-protocols@1.0.6(yjs@13.6.27))(yjs@13.6.27)':
'@hocuspocus/provider@3.2.5(y-protocols@1.0.6(yjs@13.6.27))(yjs@13.6.27)':
dependencies:
'@hocuspocus/common': 2.15.3
'@hocuspocus/common': 3.2.5
'@lifeomic/attempt': 3.1.0
lib0: 0.2.114
ws: 8.18.3