Improve information for cyclic dependency error (#5949)
This commit is contained in:
parent
745927ffef
commit
7063ee9d2d
|
|
@ -177,7 +177,7 @@ export function* evalErrorHandler(
|
||||||
case EvalErrorTypes.CYCLICAL_DEPENDENCY_ERROR: {
|
case EvalErrorTypes.CYCLICAL_DEPENDENCY_ERROR: {
|
||||||
if (error.context) {
|
if (error.context) {
|
||||||
// Add more info about node for the toast
|
// Add more info about node for the toast
|
||||||
const { entityType, node } = error.context;
|
const { dependencyMap, diffs, entityType, node } = error.context;
|
||||||
Toaster.show({
|
Toaster.show({
|
||||||
text: `${error.message} Node was: ${node}`,
|
text: `${error.message} Node was: ${node}`,
|
||||||
variant: Variant.danger,
|
variant: Variant.danger,
|
||||||
|
|
@ -191,6 +191,10 @@ export function* evalErrorHandler(
|
||||||
node,
|
node,
|
||||||
entityType,
|
entityType,
|
||||||
},
|
},
|
||||||
|
extra: {
|
||||||
|
dependencyMap,
|
||||||
|
diffs,
|
||||||
|
},
|
||||||
// Level is warning because it could be a user error
|
// Level is warning because it could be a user error
|
||||||
level: Sentry.Severity.Warning,
|
level: Sentry.Severity.Warning,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import {
|
||||||
addErrorToEntityProperty,
|
addErrorToEntityProperty,
|
||||||
convertPathToString,
|
convertPathToString,
|
||||||
CrashingError,
|
CrashingError,
|
||||||
|
DataTreeDiff,
|
||||||
DataTreeDiffEvent,
|
DataTreeDiffEvent,
|
||||||
getAllPaths,
|
getAllPaths,
|
||||||
getEntityNameAndPropertyPath,
|
getEntityNameAndPropertyPath,
|
||||||
|
|
@ -483,7 +484,10 @@ export default class DataTreeEvaluator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sortDependencies(dependencyMap: DependencyMap): Array<string> {
|
sortDependencies(
|
||||||
|
dependencyMap: DependencyMap,
|
||||||
|
diffs?: (DataTreeDiff | DataTreeDiff[])[],
|
||||||
|
): Array<string> {
|
||||||
const dependencyTree: Array<[string, string]> = [];
|
const dependencyTree: Array<[string, string]> = [];
|
||||||
Object.keys(dependencyMap).forEach((key: string) => {
|
Object.keys(dependencyMap).forEach((key: string) => {
|
||||||
if (dependencyMap[key].length) {
|
if (dependencyMap[key].length) {
|
||||||
|
|
@ -519,6 +523,8 @@ export default class DataTreeEvaluator {
|
||||||
context: {
|
context: {
|
||||||
node,
|
node,
|
||||||
entityType,
|
entityType,
|
||||||
|
dependencyMap,
|
||||||
|
diffs,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.error("CYCLICAL DEPENDENCY MAP", dependencyMap);
|
console.error("CYCLICAL DEPENDENCY MAP", dependencyMap);
|
||||||
|
|
@ -949,7 +955,10 @@ export default class DataTreeEvaluator {
|
||||||
// global inverse dependency map
|
// global inverse dependency map
|
||||||
if (didUpdateDependencyMap) {
|
if (didUpdateDependencyMap) {
|
||||||
// This is being called purely to test for new circular dependencies that might have been added
|
// This is being called purely to test for new circular dependencies that might have been added
|
||||||
this.sortedDependencies = this.sortDependencies(this.dependencyMap);
|
this.sortedDependencies = this.sortDependencies(
|
||||||
|
this.dependencyMap,
|
||||||
|
translatedDiffs,
|
||||||
|
);
|
||||||
this.inverseDependencyMap = this.getInverseDependencyTree();
|
this.inverseDependencyMap = this.getInverseDependencyTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ export enum DataTreeDiffEvent {
|
||||||
NOOP = "NOOP",
|
NOOP = "NOOP",
|
||||||
}
|
}
|
||||||
|
|
||||||
type DataTreeDiff = {
|
export type DataTreeDiff = {
|
||||||
payload: {
|
payload: {
|
||||||
propertyPath: string;
|
propertyPath: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user