Skip to content

Commit 0dea738

Browse files
committed
adjusting for missing variable swaps and removing unused memoizeProps
1 parent 04fc346 commit 0dea738

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

dash/dash-renderer/src/wrapper/DashWrapper.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ type MemoizedKeysType = {
5555
[key: string]: React.ReactNode | null; // This includes React elements, strings, numbers, etc.
5656
};
5757

58-
// Define a type for the memoized props
59-
type MemoizedPropsType = {
60-
[key: string]: any;
61-
};
62-
6358
function DashWrapper({
6459
componentPath,
6560
_dashprivate_error,
@@ -69,7 +64,6 @@ function DashWrapper({
6964
}: DashWrapperProps) {
7065
const dispatch = useDispatch();
7166
const memoizedKeys: MutableRefObject<MemoizedKeysType> = useRef({});
72-
const memoizedProps: MutableRefObject<MemoizedPropsType> = useRef({});
7367
const newRender = useRef(false);
7468
let renderComponent: any = null;
7569
let renderComponentProps: any = null;
@@ -88,21 +82,18 @@ function DashWrapper({
8882

8983
useMemo(() => {
9084
if (_newRender) {
91-
memoizedProps.current = {};
9285
newRender.current = true;
9386
renderH = 0;
94-
if (h in memoizedKeys.current) {
95-
delete memoizedKeys.current[h];
87+
if (renderH in memoizedKeys.current) {
88+
delete memoizedKeys.current[renderH];
9689
}
9790
} else {
9891
newRender.current = false;
9992
}
10093
}, [_newRender]);
10194

102-
memoizedProps.current = componentProps;
103-
10495
const setProps = (newProps: UpdatePropsPayload) => {
105-
const {id} = componentProps;
96+
const {id} = renderComponentProps;
10697
const {_dash_error, ...restProps} = newProps;
10798

10899
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -137,7 +128,7 @@ function DashWrapper({
137128
batch(() => {
138129
// setProps here is triggered by the UI - record these changes
139130
// for persistence
140-
recordUiEdit(component, newProps, dispatch);
131+
recordUiEdit(renderComponent, newProps, dispatch);
141132

142133
// Only dispatch changes to Dash if a watched prop changed
143134
if (watchedKeys.length) {

0 commit comments

Comments
 (0)