diff --git a/frontend/src/components/Search.vue b/frontend/src/components/Search.vue index e822b694..ae3d105c 100644 --- a/frontend/src/components/Search.vue +++ b/frontend/src/components/Search.vue @@ -29,12 +29,7 @@ -
+
Search Context: {{ getContext }}
@@ -102,7 +97,7 @@
-
+
Search Context: {{ getContext }}
@@ -306,7 +301,6 @@ export default { return this.isTypeSelectDisabled; }, active() { - console.log("calling active ", getters.currentPromptName()); return getters.currentPromptName() == "search"; }, showOverlay() { diff --git a/frontend/src/components/Sidebar.vue b/frontend/src/components/Sidebar.vue index 3de0e596..bd19a840 100644 --- a/frontend/src/components/Sidebar.vue +++ b/frontend/src/components/Sidebar.vue @@ -221,7 +221,7 @@ export default { return getters.currentPrompt(); }, active() { - return getters.isSidebarVisible() && getters.currentPromptName() == null; + return getters.isSidebarVisible(); }, signup: () => signup, version: () => version, diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js index c02717a3..c02e40f9 100644 --- a/frontend/src/store/getters.js +++ b/frontend/src/store/getters.js @@ -22,9 +22,17 @@ export const getters = { }, isSidebarVisible: () => { if (!getters.isLoggedIn()) { - return false + return false; } - return state.showSidebar || getters.isStickySidebar() + console.log(getters.currentPromptName()); + if (typeof getters.currentPromptName() === "string" && !getters.isStickySidebar()) { + return false; + } + console.log(getters.currentView()); + if (getters.currentView() !== "listingView") { + return false; + } + return state.showSidebar || getters.isStickySidebar(); }, isStickySidebar: () => { if (getters.isMobile()) { @@ -101,13 +109,15 @@ export const getters = { currentPromptName: () => { // Ensure state.prompts is an array - if (!Array.isArray(state.prompts)) { + if (!Array.isArray(state.prompts) || state.prompts.length === 0) { return null; } - if (state.prompts.length === 0) { + // Check if the name property is a string + const lastPrompt = state.prompts[state.prompts.length - 1]; + if (typeof lastPrompt?.name !== "string") { return null; } - return state.prompts[state.prompts.length - 1].name; + return lastPrompt.name; }, filesInUpload: () => {