Skip to content

Commit

Permalink
[2.x] Support @jupyter/ydoc 2.x (#316)
Browse files Browse the repository at this point in the history
* Support @jupyter/ydoc 2.x

* Fix yarn.lock

* Fix @jupyter/ydoc range in collaboration-extension

* Ignore new resource warning from anyio

* Fix pattern to ignore from anyio

* update snapshots

* Check if 'user' is defined in the state (server awareness can have no user defined)

* Allow the user to not be defined in the awareness state

---------

Co-authored-by: Frédéric Collonval <[email protected]>
Co-authored-by: Nicolas Brichet <[email protected]>
  • Loading branch information
3 people authored Oct 22, 2024
1 parent 53a7b6e commit 80dd8c1
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 47 deletions.
2 changes: 1 addition & 1 deletion packages/collaboration-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"dependencies": {
"@jupyter/collaboration": "^2.1.4",
"@jupyter/docprovider": "^2.1.4",
"@jupyter/ydoc": "^1.1.0-a0",
"@jupyter/ydoc": "^1.1.0 || ^2.0.0",
"@jupyterlab/application": "^4.0.5",
"@jupyterlab/apputils": "^4.0.5",
"@jupyterlab/codemirror": "^4.0.5",
Expand Down
5 changes: 5 additions & 0 deletions packages/collaboration/src/collaboratorspanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class CollaboratorsPanel extends Panel {
state.forEach((value: ICollaboratorAwareness, key: any) => {
if (
this._currentUser.isReady &&
value.user &&
value.user.username !== this._currentUser.identity!.username
) {
collaborators.push(value);
Expand Down Expand Up @@ -114,6 +115,10 @@ export class CollaboratorsBody extends ReactWidget {
let separator = '';
let currentFileLocation = '';

if (!value.user) {
return <></>;
}

if (value.current) {
canOpenCurrent = true;
const path = value.current.split(':');
Expand Down
2 changes: 1 addition & 1 deletion packages/collaboration/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface ICollaboratorAwareness {
/**
* The User owning theses data.
*/
user: User.IIdentity;
user?: User.IIdentity;

/**
* The current file/context the user is working on.
Expand Down
2 changes: 1 addition & 1 deletion packages/docprovider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyter/ydoc": "^1.1.0-a0",
"@jupyter/ydoc": "^1.1.0 || ^2.0.0",
"@jupyterlab/coreutils": "^6.0.5",
"@jupyterlab/services": "^7.0.5",
"@lumino/coreutils": "^2.1.0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 10 additions & 44 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1503,21 +1503,7 @@ __metadata:
languageName: node
linkType: hard

"@codemirror/language@npm:^6.0.0, @codemirror/language@npm:^6.3.0, @codemirror/language@npm:^6.4.0, @codemirror/language@npm:^6.6.0":
version: 6.6.0
resolution: "@codemirror/language@npm:6.6.0"
dependencies:
"@codemirror/state": ^6.0.0
"@codemirror/view": ^6.0.0
"@lezer/common": ^1.0.0
"@lezer/highlight": ^1.0.0
"@lezer/lr": ^1.0.0
style-mod: ^4.0.0
checksum: bb9411620e2f231653a3f0c4429e0d19a3843bff5dbc117df4649d7bf783ec4ad809c0add8bc0887a4ec3f48b4f8f941621168e47d76101d5383f0d670af1722
languageName: node
linkType: hard

"@codemirror/language@npm:^6.8.0":
"@codemirror/language@npm:^6.0.0, @codemirror/language@npm:^6.3.0, @codemirror/language@npm:^6.4.0, @codemirror/language@npm:^6.6.0, @codemirror/language@npm:^6.8.0":
version: 6.9.0
resolution: "@codemirror/language@npm:6.9.0"
dependencies:
Expand Down Expand Up @@ -2035,7 +2021,7 @@ __metadata:
dependencies:
"@jupyter/collaboration": ^2.1.4
"@jupyter/docprovider": ^2.1.4
"@jupyter/ydoc": ^1.1.0-a0
"@jupyter/ydoc": ^1.1.0 || ^2.0.0
"@jupyterlab/application": ^4.0.5
"@jupyterlab/apputils": ^4.0.5
"@jupyterlab/builder": ^4.0.5
Expand Down Expand Up @@ -2090,7 +2076,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@jupyter/docprovider@workspace:packages/docprovider"
dependencies:
"@jupyter/ydoc": ^1.1.0-a0
"@jupyter/ydoc": ^1.1.0 || ^2.0.0
"@jupyterlab/coreutils": ^6.0.5
"@jupyterlab/services": ^7.0.5
"@jupyterlab/testing": ^4.0.5
Expand Down Expand Up @@ -2144,17 +2130,17 @@ __metadata:
languageName: node
linkType: hard

"@jupyter/ydoc@npm:^1.1.0-a0":
version: 1.1.0-a0
resolution: "@jupyter/ydoc@npm:1.1.0-a0"
"@jupyter/ydoc@npm:^1.1.0 || ^2.0.0":
version: 2.1.3
resolution: "@jupyter/ydoc@npm:2.1.3"
dependencies:
"@jupyterlab/nbformat": ^3.0.0 || ^4.0.0-alpha.21 || ^4.0.0
"@lumino/coreutils": ^1.11.0 || ^2.0.0
"@lumino/disposable": ^1.10.0 || ^2.0.0
"@lumino/signaling": ^1.10.0 || ^2.0.0
y-protocols: ^1.0.5
yjs: ^13.5.40
checksum: 0099bacb2884a460867658e7f5a944e4d6eca7c4d3d68a6b31102be77d8fc9b6ba162af55c20f81c70f7fef4e9d9329eee4da32063c0caa0c6e3f10a488f95b5
checksum: 61b38e3f89accebc8060eb0aacc11bf812befb9b1cec085d1b0153be851037a3a26b5576d58e5bc65d8c0697ef9f1e535afa73af1b1deef0523d749ff4ac0ac9
languageName: node
linkType: hard

Expand Down Expand Up @@ -2544,16 +2530,7 @@ __metadata:
languageName: node
linkType: hard

"@jupyterlab/nbformat@npm:^3.0.0 || ^4.0.0-alpha.21 || ^4.0.0":
version: 4.0.0
resolution: "@jupyterlab/nbformat@npm:4.0.0"
dependencies:
"@lumino/coreutils": ^2.1.1
checksum: 152da6b9622c7683543ad2bd9525857a8a39b4b8a5474998e921232f108c366dd8625daeb14e2cc2aa8aac124b9a5d16f285310cd241c9769d51af80730dbd59
languageName: node
linkType: hard

"@jupyterlab/nbformat@npm:^4.0.5":
"@jupyterlab/nbformat@npm:^3.0.0 || ^4.0.0-alpha.21 || ^4.0.0, @jupyterlab/nbformat@npm:^4.0.5":
version: 4.0.5
resolution: "@jupyterlab/nbformat@npm:4.0.5"
dependencies:
Expand Down Expand Up @@ -3110,7 +3087,7 @@ __metadata:
languageName: node
linkType: hard

"@lumino/coreutils@npm:^1.11.0 || ^2.0.0, @lumino/coreutils@npm:^1.11.0 || ^2.1.2, @lumino/coreutils@npm:^2.1.0, @lumino/coreutils@npm:^2.1.1, @lumino/coreutils@npm:^2.1.2":
"@lumino/coreutils@npm:^1.11.0 || ^2.0.0, @lumino/coreutils@npm:^1.11.0 || ^2.1.2, @lumino/coreutils@npm:^2.1.0, @lumino/coreutils@npm:^2.1.2":
version: 2.1.2
resolution: "@lumino/coreutils@npm:2.1.2"
checksum: 7865317ac0676b448d108eb57ab5d8b2a17c101995c0f7a7106662d9fe6c859570104525f83ee3cda12ae2e326803372206d6f4c1f415a5b59e4158a7b81066f
Expand Down Expand Up @@ -4028,18 +4005,7 @@ __metadata:
languageName: node
linkType: hard

"@types/react@npm:^18.0.26, @types/react@npm:^18.0.27":
version: 18.2.6
resolution: "@types/react@npm:18.2.6"
dependencies:
"@types/prop-types": "*"
"@types/scheduler": "*"
csstype: ^3.0.2
checksum: dea9d232d8df7ac357367a69dcb557711ab3d5501807ffa77cebeee73d49ee94d095f298e36853c63ed47cce097eee4c7eae2aaa8c02fac3f0171ec1b523a819
languageName: node
linkType: hard

"@types/react@npm:~18.0.26":
"@types/react@npm:^18.0.26, @types/react@npm:^18.0.27, @types/react@npm:~18.0.26":
version: 18.0.38
resolution: "@types/react@npm:18.0.38"
dependencies:
Expand Down

0 comments on commit 80dd8c1

Please sign in to comment.