Skip to content

Commit

Permalink
[Workpad Loader] Redirect to home if there are no remaining workpads …
Browse files Browse the repository at this point in the history
…left after delete (elastic#682)

Closes https://github.com/elastic/kibana-canvas/issues/674

# Before
Deleting the last workpad in the set would not clear it out of the area, allowing you to continue making changes. Attempts to persist updates would result in a 404
![wkpddeletebefore](https://user-images.githubusercontent.com/908371/41438488-42fb1684-6fdc-11e8-8b66-5de6f5d647e3.gif)

# After
Delete the last workpad, and you'll be taken to the home route
![wkpddeleteafter](https://user-images.githubusercontent.com/908371/41438506-519f9a02-6fdc-11e8-8910-7f0e74fbd431.gif)
  • Loading branch information
tsullivan authored and w33ble committed Jun 14, 2018
1 parent c95535c commit 7ec15b0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions public/components/workpad_loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ export const WorkpadLoader = compose(
const nextWorkpad = workpadState.workpads[0];
if (nextWorkpad != null) {
props.router.navigateTo('loadWorkpad', { id: nextWorkpad.id, page: 1 });

// update the workpad list, filtering out the removed workpad
setWorkpads(workpadState);
} else {
props.router.navigateTo('home');
}
}

// update the workpad list, filtering out the removed workpad
setWorkpads(workpadState);
},
})
)(Component);

0 comments on commit 7ec15b0

Please sign in to comment.