Skip to content

Commit

Permalink
[dashboard] Prevent that the tab of “New Workspace“ changes when visible
Browse files Browse the repository at this point in the history
Fixes #3764
  • Loading branch information
corneliusludmann committed Jun 14, 2021
1 parent b87595a commit 20044d3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Mode = 'Recent' | 'Examples';
export function StartWorkspaceModal(p: StartWorkspaceModalProps) {
const computeSelection = () => p.selected || (p.recent.length > 0 ? 'Recent' : 'Examples');
const [selection, setSelection] = useState(computeSelection());
useEffect(() => setSelection(computeSelection()), [p.recent, p.selected]);
useEffect(() => { !p.visible && setSelection(computeSelection()) }, [p.visible, p.recent, p.selected]);

const list = (selection === 'Recent' ? p.recent : p.examples).map((e, i) =>
<a key={`item-${i}-${e.title}`} href={e.startUrl} className="rounded-xl group hover:bg-gray-100 dark:hover:bg-gray-800 flex p-4 my-1">
Expand Down

0 comments on commit 20044d3

Please sign in to comment.