kedro-org / kedro-viz

Visualise your Kedro data and machine-learning pipelines and track your experiments.
https://demo.kedro.org
Apache License 2.0
681 stars 113 forks source link

Fix FE when `tag` name is `undefined` #2146

Closed rashidakanchwala closed 4 weeks ago

rashidakanchwala commented 1 month ago

Description

Partly resolves #2106

Development notes

In the user's pipeline, one of the nodes was tagged as validation. While this tag was mentioned in the { node: { tags: [] } } response, it wasn't somehow mentioned in the { tags: {} } response which caused the flowchart to break. We were unable to reproduce this issue on the backend, which would have been the optimal place to address it.

As a workaround, we fixed this on the frontend. When a tag is not defined correctly in the backend, the frontend cannot link the tag to the corresponding tag name. Since the tag name and ID are the same, we added a fallback. If the tag name is undefined (due to an error we still need to investigate), we use the tag ID itself as a fallback. This prevents Kedro-Viz from breaking and ensures the flowchart runs correctly.

QA notes

To test this fix using the demo project:

Run kedro viz --save-file=test. This will create a test folder with an api folder inside. Move the api folder into the kedro-viz/public directory. Remove 'company' dict from tags: in api/main folder Run npm run start:dev. Before this PR, you will see the app breaking with the error message the user encountered. After applying the PR, the issue will be fixed.

Checklist

rashidakanchwala commented 1 month ago

Kacper confirmed that this PR resolves the main issue i.e it doesn't break Kedro-viz; the outputs of pipelines are not entirely correct. and when he gets time he will create some example pipelines that we can use to reproduce and fix this bug.

FYI @astrojuanlu