box-annotations 4.1.1-beta.5 → 5.1.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.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import * as ReactDOM from 'react-dom';
2
+ import * as ReactDOM from 'react-dom/client';
3
3
  import BaseManager, { Props } from '../common/BaseManager';
4
4
  import PopupContainer from './PopupContainer';
5
5
 
@@ -10,6 +10,10 @@ export default class PopupManager extends BaseManager {
10
10
  }
11
11
 
12
12
  render(props: Props): void {
13
- ReactDOM.render(<PopupContainer location={this.location} {...props} />, this.reactEl);
13
+ if (!this.root) {
14
+ this.root = ReactDOM.createRoot(this.reactEl);
15
+ }
16
+
17
+ this.root.render(<PopupContainer location={this.location} {...props} />);
14
18
  }
15
19
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import * as ReactDOM from 'react-dom';
2
+ import * as ReactDOM from 'react-dom/client';
3
3
  import BaseManager, { Props } from '../common/BaseManager';
4
4
  import RegionCreationContainer from './RegionCreationContainer';
5
5
 
@@ -10,6 +10,10 @@ export default class RegionManager extends BaseManager {
10
10
  }
11
11
 
12
12
  render(props: Props): void {
13
- ReactDOM.render(<RegionCreationContainer location={this.location} {...props} />, this.reactEl);
13
+ if (!this.root) {
14
+ this.root = ReactDOM.createRoot(this.reactEl);
15
+ }
16
+
17
+ this.root.render(<RegionCreationContainer location={this.location} {...props} />);
14
18
  }
15
19
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import * as ReactDOM from 'react-dom';
2
+ import * as ReactDOM from 'react-dom/client';
3
3
  import BaseManager, { Props } from '../common/BaseManager';
4
4
  import RegionAnnotationsContainer from './RegionAnnotationsContainer';
5
5
 
@@ -10,6 +10,10 @@ export default class RegionListManager extends BaseManager {
10
10
  }
11
11
 
12
12
  render(props: Props): void {
13
- ReactDOM.render(<RegionAnnotationsContainer location={this.location} {...props} />, this.reactEl);
13
+ if (!this.root) {
14
+ this.root = ReactDOM.createRoot(this.reactEl);
15
+ }
16
+
17
+ this.root.render(<RegionAnnotationsContainer location={this.location} {...props} />);
14
18
  }
15
19
  }
@@ -17,7 +17,6 @@ export const createRegionAction = (arg: CreateArg) => (dispatch: AppThunkDispatc
17
17
  message,
18
18
  type: 'reply' as const,
19
19
  },
20
- // eslint-disable-next-line @typescript-eslint/camelcase
21
20
  file_version: {
22
21
  id: getFileVersionId(state),
23
22
  },
@@ -19,7 +19,7 @@ declare global {
19
19
  createNodeIterator(
20
20
  root: Node,
21
21
  whatToShow?: number,
22
- filter?: NodeFilter | Function,
22
+ filter?: NodeFilter | ((node: Node) => number | null),
23
23
  entityReferenceExpansion?: boolean,
24
24
  ): NodeIterator;
25
25
  }
@@ -20,9 +20,9 @@ export const fetchCollaboratorsAction = createAsyncThunk<APICollection<Collabora
20
20
  // Wrap the client request in a promise to allow it to be returned and cancelled
21
21
  return new Promise<APICollection<Collaborator>>((resolve, reject) => {
22
22
  client.getFileCollaborators(fileId, resolve, reject, {
23
- filter_term: searchString, // eslint-disable-line @typescript-eslint/camelcase
24
- include_groups: false, // eslint-disable-line @typescript-eslint/camelcase
25
- include_uploader_collabs: false, // eslint-disable-line @typescript-eslint/camelcase
23
+ filter_term: searchString,
24
+ include_groups: false,
25
+ include_uploader_collabs: false,
26
26
  });
27
27
  });
28
28
  },
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
-
3
- // Returns the last provided value, then caches the new value via an effect
4
- export default function usePrevious<T>(value: T): T | undefined {
5
- const ref = React.useRef<T>();
6
-
7
- // The useEffect callback is only invoked after the parent component has rendered
8
- React.useEffect(() => {
9
- ref.current = value;
10
- }, [value]);
11
-
12
- return ref.current;
13
- }