Skip to content

Commit 09678f5

Browse files
committed
Update
1 parent 30e7be2 commit 09678f5

File tree

3 files changed

+6
-29
lines changed

3 files changed

+6
-29
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.22 ()
2+
3+
* Removal of isEditing from SceneComponentProps (also $editor from SceneObjectState, and sceneGraph.getSceneEditor)
4+
15
# 0.21 (2023-03-17)
26

37
**SceneObject subscribeToState parameter change**
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React, { useEffect } from 'react';
22

3-
import { SceneComponentCustomWrapper, SceneComponentProps, SceneObject } from './types';
3+
import { SceneComponentProps, SceneObject } from './types';
44

55
function SceneComponentWrapperWithoutMemo<T extends SceneObject>({ model, ...otherProps }: SceneComponentProps<T>) {
66
const Component = (model as any).constructor['Component'] ?? EmptyRenderer;
7-
const inner = <Component {...otherProps} model={model} />;
8-
const CustomWrapper = getComponentWrapper(model);
97

108
// Handle component activation state state
119
useEffect(() => {
@@ -19,30 +17,11 @@ function SceneComponentWrapperWithoutMemo<T extends SceneObject>({ model, ...oth
1917
};
2018
}, [model]);
2119

22-
if (CustomWrapper) {
23-
return <CustomWrapper model={model}>{inner}</CustomWrapper>;
24-
}
25-
26-
return inner;
20+
return <Component {...otherProps} model={model} />;
2721
}
2822

2923
export const SceneComponentWrapper = React.memo(SceneComponentWrapperWithoutMemo);
3024

3125
function EmptyRenderer<T>(_: SceneComponentProps<T>): React.ReactElement | null {
3226
return null;
3327
}
34-
35-
/**
36-
* If this or any parent has componentWrapper then return and use that
37-
*/
38-
function getComponentWrapper(sceneObject: SceneObject): SceneComponentCustomWrapper | undefined {
39-
if (sceneObject.componentWrapper) {
40-
return sceneObject.componentWrapper;
41-
}
42-
43-
if (sceneObject.parent) {
44-
return getComponentWrapper(sceneObject.parent);
45-
}
46-
47-
return undefined;
48-
}

packages/scenes/src/core/types.ts

-6
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ export interface SceneObject<TState extends SceneObjectState = SceneObjectState>
7272
/** This abstraction declares URL sync dependencies of a scene object. **/
7373
readonly urlSync?: SceneObjectUrlSyncHandler<TState>;
7474

75-
/**
76-
* Component wrapper, can be used to for edit modes, to wrap objects in an edit wrappers. This component wrapper will
77-
* be used for all children of this object (unless they specify their own wrapper).
78-
**/
79-
readonly componentWrapper?: SceneComponentCustomWrapper;
80-
8175
/** Subscribe to state changes */
8276
subscribeToState(handler: SceneStateChangedHandler<TState>): Unsubscribable;
8377

0 commit comments

Comments
 (0)