Hello everyone!
I’m having a problem setting a rule in a class I created called CustomRuleProvider that extends RuleProvider. I have defined two rules: one for shape.create and another for connection.create. The rule for shape.create works correctly, but the one for connection.create does not. In fact, when I want to create a sequence flow from the context pad or the pallette, I get many errors in the console, which are these:
This is something similar to the code I have in the rule:
this.addRule('connection.create', 1500, function(context) {
let result = ElementIDService.verifyID(context);
return result; // always boolean result
});
On the other hand, if I have something like this instead, it works perfectly:
Can you share the custom code you’re using to create the connection? As you can see there are some NaNs which lead to an error. Probably the waypoints of the new connection?
Hello again!
The only custom code I have for the sequence flows creation (although it does not edit the waypoints) is in a class that extends CommandInterceptor with a postExecute(“create.connection”…). But when I debug, this error occurs before that postExecute function. Doing a little more research, it seems that the error is indeed coming from the connection waypoints, particularly in this function from bpmn-js/lib/draw/BpmnRenderer.js:
What I don’t understand is why this error began to happen after incorporating this custom rule in CustomRuleProvider. Here I show you how I defined the rule after the first solution you provided me:
this.addRule('connection.create', 1500, function(context) {
let result;
result = ElementIDService.verifyID(context); //boolean result
if (!result) {
return result;
}
return { type: 'bpmn:SequenceFlow' };
});
To add more details, this is the sequence flow with NaN values in waypoints with the rule:
And this is the sequence flow without the rule:
Edit: for an unknown reason, I recently discovered that this error doesn´t occur in Firefox, but it does in others browsers such as Chrome and Brave
Hello!
Yes, I´m sure. I have reviewed the project to find any custom behavior regarding the waypoints and I have not found anything. I can’t upload the project to a sandbox to show you because I don’t have permission to do it in my team.
In any case, I insist, the strangest thing is that this error occurs, for example, in Chrome or Brave, and not in Firefox, which are the browsers I have tried so far.
The only custom code I have for the sequence flows creation (although it does not edit the waypoints) is in a class that extends CommandInterceptor with a postExecute