Dragable link from pallete to canvas not validating and even not connecting to node when apply linkvalidation

when drag the link from node to node is working fine, but when drag the link to canvase not validating.

private linkValidation(tool) {
      tool.linkValidation =  function(fromnode, fromport, tonode, toport) {
        // total number of links connecting with a port is limited to 1:
       
        if(fromnode.findLinksBetween(tonode).count < 1) {
          return true
        } else {
          return false
        }
      }
  }

public ngAfterViewInit() {
 this.linkValidation(this.dia.toolManager.linkingTool);
    this.linkValidation(this.dia.toolManager.relinkingTool);
}```

When I add this line to the initialization of the RelinkingTool in the Draggable Link sample, it properly outputs “relinking” to the console when I drag a link from the Palette to the main Diagram.

"relinkingTool.linkValidation": (fn, fp, tn, tp) => { console.log("relinking"); return true; },