@neo4j-nvl/react 1.1.0-da87d9ae → 1.1.0-e1857362

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.
@@ -47,6 +47,16 @@ describe('BasicNvlWrapper', () => {
47
47
  expect(NVL).toHaveBeenCalledTimes(2);
48
48
  expect(destroy).toHaveBeenCalledTimes(1);
49
49
  });
50
+ test('reapplies zoom and pan when re-initialising NVL with React StrictMode', () => {
51
+ const destroy = jest.fn();
52
+ jest.spyOn(NVL.prototype, 'destroy').mockImplementation(destroy);
53
+ render(_jsx(StrictMode, { children: _jsx("div", { children: _jsx(BasicNvlWrapper, { nodes: [], rels: [], zoom: 1.5, pan: { x: 10, y: 20 } }) }) }));
54
+ expect(NVL).toHaveBeenCalledTimes(2);
55
+ expect(destroy).toHaveBeenCalledTimes(1);
56
+ expect(setZoomAndPan).toHaveBeenCalledTimes(2);
57
+ expect(setZoomAndPan).toHaveBeenNthCalledWith(1, 1.5, 10, 20);
58
+ expect(setZoomAndPan).toHaveBeenNthCalledWith(2, 1.5, 10, 20);
59
+ });
50
60
  test('calls setZoom when zoom property is provided', () => {
51
61
  render(_jsx("div", { children: _jsx(BasicNvlWrapper, { nodes: [], rels: [], zoom: 1.5 }) }));
52
62
  expect(setZoom).toHaveBeenCalledWith(1.5);
@@ -36,6 +36,8 @@ export const BasicNvlWrapper = memo(forwardRef(({ nodes, rels, layout, layoutOpt
36
36
  return () => {
37
37
  nvlRef.current?.destroy();
38
38
  nvlRef.current = null;
39
+ prevZoomRef.current = undefined;
40
+ prevPanRef.current = undefined;
39
41
  };
40
42
  }, []);
41
43
  useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/react",
3
- "version": "1.1.0-da87d9ae",
3
+ "version": "1.1.0-e1857362",
4
4
  "main": "lib/index.js",
5
5
  "homepage": "https://neo4j.com/docs/nvl/current/",
6
6
  "license": "SEE LICENSE IN 'LICENSE.txt'",
@@ -36,8 +36,8 @@
36
36
  "react-dom": "19.2.1"
37
37
  },
38
38
  "dependencies": {
39
- "@neo4j-nvl/base": "1.1.0-da87d9ae",
40
- "@neo4j-nvl/interaction-handlers": "1.1.0-da87d9ae",
39
+ "@neo4j-nvl/base": "1.1.0-e1857362",
40
+ "@neo4j-nvl/interaction-handlers": "1.1.0-e1857362",
41
41
  "lodash": "4.18.1"
42
42
  },
43
43
  "peerDependencies": {