Skip to content

Commit

Permalink
[KED-2144] Scrolling on Kedro-Viz throws errors when pipeline is empty (
Browse files Browse the repository at this point in the history
#342)

* added checks for infinity or NaN values for zoom

* further include zoom actions with checks

* moved and added comments

* added tests to test for invalid zoom values

* update according to PR comment

* deleted tests ( more proper test set up for flowchart zoom will commence in seperate ticket)

* move check before scaling operations
  • Loading branch information
studioswong authored Jan 11, 2021
1 parent a2f18a9 commit 64c0d0c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/flowchart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ export class FlowChart extends Component {
// When zoom changes
.on('zoom', () => {
const { k: scale, x, y } = event.transform;

// Ensure valid x and y values before performing zoom operations
if (!isFinite(x) || !isFinite(y) || isNaN(x) || isNaN(y)) {
return;
}

const [
minScale = 0,
maxScale = Infinity
Expand Down

0 comments on commit 64c0d0c

Please sign in to comment.