From 125bdad7967c6f3e34994db18d67d2e7350fe0e6 Mon Sep 17 00:00:00 2001 From: Shoaibdev7 Date: Sun, 20 Oct 2024 01:48:06 +0500 Subject: [PATCH] fix(test): cypress --- src/components/Universe/index.tsx | 7 ++++++- src/stores/useAppStore/index.ts | 6 +----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/Universe/index.tsx b/src/components/Universe/index.tsx index 0936ff25f..9af09eb32 100644 --- a/src/components/Universe/index.tsx +++ b/src/components/Universe/index.tsx @@ -13,6 +13,7 @@ import { isDevelopment } from '~/constants' import { useAppStore } from '~/stores/useAppStore' import { useControlStore } from '~/stores/useControlStore' import { useDataStore } from '~/stores/useDataStore' +import { useFeatureFlagStore } from '~/stores/useFeatureFlagStore' import { useSelectedNode } from '~/stores/useGraphStore' import { colors } from '~/utils/colors' import { addToGlobalForE2e } from '~/utils/tests' @@ -98,6 +99,10 @@ const _Universe = () => { const isLoading = useDataStore((s) => s.isFetching) const universeQuestionIsOpen = useAppStore((s) => s.universeQuestionIsOpen) + const { chatInterfaceFeatureFlag } = useFeatureFlagStore((s) => ({ + chatInterfaceFeatureFlag: s.chatInterfaceFeatureFlag, + })) + const onWheelHandler = useCallback( (e: React.WheelEvent) => { const { target } = e @@ -143,7 +148,7 @@ const _Universe = () => { - {universeQuestionIsOpen && } + {chatInterfaceFeatureFlag && universeQuestionIsOpen && } {isLoading && } diff --git a/src/stores/useAppStore/index.ts b/src/stores/useAppStore/index.ts index 370a08756..de3e1b1c0 100644 --- a/src/stores/useAppStore/index.ts +++ b/src/stores/useAppStore/index.ts @@ -1,6 +1,5 @@ import { create } from 'zustand' import { TAboutParams } from '~/network/fetchSourcesData' -import { useFeatureFlagStore } from '~/stores/useFeatureFlagStore' export type SecondarySidebarActiveTab = '' | 'sentiment' | 'sources' | 'about' @@ -72,11 +71,8 @@ export const useAppStore = create((set, get) => ({ transcriptIsOpen: !sidebarIsOpen ? false : get().transcriptIsOpen, }), setTranscriptOpen: (transcriptIsOpen) => set({ transcriptIsOpen }), - setUniverseQuestionIsOpen: () => { - const { chatInterfaceFeatureFlag } = useFeatureFlagStore.getState() + setUniverseQuestionIsOpen: () => set({ universeQuestionIsOpen: !get().universeQuestionIsOpen }), - set({ universeQuestionIsOpen: chatInterfaceFeatureFlag ? !get().universeQuestionIsOpen : false }) - }, setAppMetaData: (appMetaData) => set({ appMetaData }), setShowCollapseButton: (showCollapseButton) => set({ showCollapseButton }), setSelectedColor: (selectedColor) => set({ selectedColor }),