For Fabric > 6.0.0 use this:
fabric.loadSVGFromString(svg).then((result) => { canvas.add(...(result.objects.filter((obj) => !!obj)))renderAll(); });