@wandelbots/wandelbots-js-react-components 1.40.0 → 1.41.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "1.40.0",
3
+ "version": "1.41.0",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -25,6 +25,12 @@ export type JoggingPanelProps = {
25
25
  /** Set this to true to disable jogging UI temporarily e.g. when a program is executing */
26
26
  locked?: boolean
27
27
  sx?: SxProps
28
+
29
+ /**
30
+ * To preserve state while the jogging panel is hidden, you can create and pass a
31
+ * JoggingStore here and it will be used instead of creating a new one.
32
+ */
33
+ store?: JoggingStore
28
34
  }
29
35
 
30
36
  /**
@@ -48,8 +54,11 @@ export const JoggingPanel = externalizeComponent(
48
54
  })
49
55
 
50
56
  try {
51
- const jogger = await nova.connectJogger(props.motionGroupId)
52
- const joggingStore = await JoggingStore.loadFor(jogger)
57
+ let joggingStore = props.store
58
+ if (!joggingStore) {
59
+ const jogger = await nova.connectJogger(props.motionGroupId)
60
+ joggingStore = await JoggingStore.loadFor(jogger)
61
+ }
53
62
  runInAction(() => {
54
63
  state.joggingStore = joggingStore
55
64
  })
@@ -63,10 +72,12 @@ export const JoggingPanel = externalizeComponent(
63
72
 
64
73
  useEffect(() => {
65
74
  init()
66
- return () => {
67
- state.joggingStore?.dispose()
68
- }
69
- }, [props.nova, props.motionGroupId])
75
+ return props.store
76
+ ? () => null
77
+ : () => {
78
+ state.joggingStore?.dispose()
79
+ }
80
+ }, [props.store, props.nova, props.motionGroupId])
70
81
 
71
82
  useEffect(() => {
72
83
  const store = state.joggingStore
package/src/index.ts CHANGED
@@ -3,7 +3,7 @@ export * from "./components/3d-viewport/SafetyZonesRenderer"
3
3
  export * from "./components/jogging/JoggingCartesianAxisControl"
4
4
  export * from "./components/jogging/JoggingJointRotationControl"
5
5
  export * from "./components/jogging/JoggingPanel"
6
- export type { JoggingStore } from "./components/jogging/JoggingStore"
6
+ export { JoggingStore } from "./components/jogging/JoggingStore"
7
7
  export * from "./components/jogging/PoseCartesianValues"
8
8
  export * from "./components/jogging/PoseJointValues"
9
9
  export * from "./components/LoadingCover"