Fix undefined error in debugger sagas (#4291)
Use correct types and check if validationMessages exists as it could be undefined
This commit is contained in:
parent
1286af4285
commit
6ad40de1e5
|
|
@ -17,14 +17,18 @@ import { getDebuggerErrors } from "selectors/debuggerSelectors";
|
|||
import { getAction } from "selectors/entitiesSelector";
|
||||
import { Action, PluginType } from "entities/Action";
|
||||
import LOG_TYPE from "entities/AppsmithConsole/logtype";
|
||||
import { DataTree } from "entities/DataTree/dataTreeFactory";
|
||||
import { isWidget } from "workers/evaluationUtils";
|
||||
|
||||
function* onWidgetUpdateSaga(payload: LogActionPayload) {
|
||||
if (!payload.source) return;
|
||||
// Wait for data tree update
|
||||
yield take(ReduxActionTypes.SET_EVALUATED_TREE);
|
||||
const dataTree = yield select(getDataTree);
|
||||
const dataTree: DataTree = yield select(getDataTree);
|
||||
const widget = dataTree[payload.source.name];
|
||||
|
||||
if (!isWidget(widget) || !widget.validationMessages) return;
|
||||
|
||||
// Ignore canvas widget updates
|
||||
if (widget.type === WidgetTypes.CANVAS_WIDGET) {
|
||||
return;
|
||||
|
|
@ -35,7 +39,7 @@ function* onWidgetUpdateSaga(payload: LogActionPayload) {
|
|||
if (payload.state) {
|
||||
const propertyPath = Object.keys(payload.state)[0];
|
||||
|
||||
const validationMessages = dataTree[payload.source.name].validationMessages;
|
||||
const validationMessages = widget.validationMessages;
|
||||
const validationMessage = validationMessages[propertyPath];
|
||||
const errors = yield select(getDebuggerErrors);
|
||||
const errorId = `${source.id}-${propertyPath}`;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user