@jupyter/collaboration 4.0.0-alpha.0 → 4.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,15 +49,19 @@ export class CollaboratorsPanel extends Panel {
49
49
  */
50
50
  this._onAwarenessChanged = () => {
51
51
  const state = this._awareness.getStates();
52
- const collaborators = [];
52
+ const collaboratorsMap = new Map();
53
53
  state.forEach((value, key) => {
54
54
  if (this._currentUser.isReady &&
55
55
  value.user &&
56
56
  value.user.username !== this._currentUser.identity.username) {
57
- collaborators.push(value);
57
+ const uniqueKey = `${value.user.username}-${value.current || 'no-current'}`;
58
+ if (!collaboratorsMap.has(uniqueKey)) {
59
+ collaboratorsMap.set(uniqueKey, value);
60
+ }
58
61
  }
59
62
  });
60
- this._collaboratorsChanged.emit(collaborators);
63
+ // Convert map to array to maintain the same emit interface
64
+ this._collaboratorsChanged.emit(Array.from(collaboratorsMap.values()));
61
65
  };
62
66
  this._collaboratorsChanged = new Signal(this);
63
67
  this._awareness = awareness;
@@ -72,8 +76,9 @@ export function CollaboratorsBody(props) {
72
76
  props.collaboratorsChanged.connect((_, value) => {
73
77
  setCollaborators(value);
74
78
  });
75
- return (React.createElement("div", { className: COLLABORATORS_LIST_CLASS }, collaborators.map((collaborator, i) => {
76
- return (React.createElement(Collaborator, { collaborator: collaborator, fileopener: props.fileopener, docRegistry: props.docRegistry }));
79
+ return (React.createElement("div", { className: COLLABORATORS_LIST_CLASS }, collaborators.map(collaborator => {
80
+ const uniqueKey = `${collaborator.user.username}-${collaborator.current || 'no-current'}`;
81
+ return (React.createElement(Collaborator, { key: uniqueKey, collaborator: collaborator, fileopener: props.fileopener, docRegistry: props.docRegistry }));
77
82
  })));
78
83
  }
79
84
  export function Collaborator(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter/collaboration",
3
- "version": "4.0.0-alpha.0",
3
+ "version": "4.0.0-rc.0",
4
4
  "description": "JupyterLab - Real-Time Collaboration Widgets",
5
5
  "homepage": "https://github.com/jupyterlab/jupyter-collaboration",
6
6
  "bugs": {
@@ -41,15 +41,15 @@
41
41
  "dependencies": {
42
42
  "@codemirror/state": "^6.2.0",
43
43
  "@codemirror/view": "^6.7.0",
44
- "@jupyterlab/apputils": "^4.4.0-alpha.2",
45
- "@jupyterlab/coreutils": "^6.4.0-alpha.2",
46
- "@jupyterlab/docregistry": "^4.4.0-alpha.2",
47
- "@jupyterlab/services": "^7.4.0-alpha.2",
48
- "@jupyterlab/ui-components": "^4.4.0-alpha.2",
49
- "@lumino/coreutils": "^2.1.0",
50
- "@lumino/signaling": "^2.0.0",
51
- "@lumino/virtualdom": "^2.0.0",
52
- "@lumino/widgets": "^2.1.0",
44
+ "@jupyterlab/apputils": "^4.4.0",
45
+ "@jupyterlab/coreutils": "^6.4.0",
46
+ "@jupyterlab/docregistry": "^4.4.0",
47
+ "@jupyterlab/services": "^7.4.0",
48
+ "@jupyterlab/ui-components": "^4.4.0",
49
+ "@lumino/coreutils": "^2.2.1",
50
+ "@lumino/signaling": "^2.1.4",
51
+ "@lumino/virtualdom": "^2.0.3",
52
+ "@lumino/widgets": "^2.7.0",
53
53
  "react": "^18.2.0",
54
54
  "y-protocols": "^1.0.5",
55
55
  "yjs": "^13.5.40"