Fix bug with brush tool dissapearing when collpased

This commit is contained in:
Mitchell McCaffrey 2020-07-18 10:46:18 +10:00
parent 8c92d19b9c
commit 17043745de

View File

@ -13,8 +13,9 @@ function ToolSection({ collapse, tools, onToolClick }) {
if (selectedTool) {
setCollapsedTool(selectedTool);
} else {
setCollapsedTool(
(prevTool) => prevTool && { ...prevTool, isSelected: false }
// No selected tool, deselect if we have a tool or get the first tool if not
setCollapsedTool((prevTool) =>
prevTool ? { ...prevTool, isSelected: false } : tools[0]
);
}
}, [tools]);