Skip to content

Commit 3fab4e4

Browse files
committed
small refactor
1 parent c95671e commit 3fab4e4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

chartlets.js/packages/lib/src/actions/handleHostStoreChange.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export function getCallbackRequests(
7272
);
7373
}
7474

75-
// This is a dummy function created to memoize the _inputValues values
75+
// This is a dummy function created to memoize the _inputValues values from
76+
// getCallbackRequest()
7677
const _getInputValues = (_inputValues: unknown[]): unknown[] => {
7778
return _inputValues;
7879
};
@@ -99,9 +100,9 @@ const getCallbackRequest = (
99100

100101
const inputValues = memoizedInputValues(_inputValues);
101102

102-
const propRefId = `${contribPoint}-${contribIndex}-${callbackIndex}-${inputIndex}`;
103+
const callbackId = `${contribPoint}-${contribIndex}-${callbackIndex}-${inputIndex}`;
103104
if (lastCallbackInputValues) {
104-
const lastInputValues = lastCallbackInputValues[propRefId];
105+
const lastInputValues = lastCallbackInputValues[callbackId];
105106
if (lastInputValues && shallowEqualArrays(lastInputValues, inputValues)) {
106107
// We no longer log, as the situation is quite common
107108
// Enable error logging for debugging only:
@@ -110,12 +111,12 @@ const getCallbackRequest = (
110111
// console.groupEnd();
111112
return undefined;
112113
}
113-
lastCallbackInputValues[propRefId] = inputValues;
114+
lastCallbackInputValues[callbackId] = inputValues;
114115
store.setState({
115116
lastCallbackInputValues: { ...lastCallbackInputValues },
116117
});
117118
} else {
118-
store.setState({ lastCallbackInputValues: { [propRefId]: inputValues } });
119+
store.setState({ lastCallbackInputValues: { [callbackId]: inputValues } });
119120
}
120121
return { ...propertyRef, inputValues };
121122
};

0 commit comments

Comments
 (0)