From 0a5195d1abbaf563c6de1a5f0cb95a13b164c3ed Mon Sep 17 00:00:00 2001 From: vinodkiran Date: Fri, 23 Feb 2024 07:07:46 +0530 Subject: [PATCH] Bugfix: View Toggle loses state when button is clicked twice. --- packages/ui/src/views/chatflows/index.js | 2 ++ packages/ui/src/views/marketplaces/index.js | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/ui/src/views/chatflows/index.js b/packages/ui/src/views/chatflows/index.js index c87ad306..c1e9ade4 100644 --- a/packages/ui/src/views/chatflows/index.js +++ b/packages/ui/src/views/chatflows/index.js @@ -47,6 +47,8 @@ const Chatflows = () => { const [view, setView] = React.useState(localStorage.getItem('flowDisplayStyle') || 'card') const handleChange = (event, nextView) => { + if (nextView === null) return + console.log('nextView == ' + nextView) localStorage.setItem('flowDisplayStyle', nextView) setView(nextView) } diff --git a/packages/ui/src/views/marketplaces/index.js b/packages/ui/src/views/marketplaces/index.js index e5a65cb9..a6d29e43 100644 --- a/packages/ui/src/views/marketplaces/index.js +++ b/packages/ui/src/views/marketplaces/index.js @@ -131,6 +131,7 @@ const Marketplace = () => { } const handleViewChange = (event, nextView) => { + if (nextView === null) return localStorage.setItem('mpDisplayStyle', nextView) setView(nextView) }