Skip to content

Commit dda0e45

Browse files
committed
[NEB-225] Fix Nebula new chat button link
1 parent cef477d commit dda0e45

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

apps/dashboard/src/app/nebula-app/(app)/components/ChatPageContent.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { type NebulaContext, promptNebula } from "../api/chat";
2222
import { createSession, updateSession } from "../api/session";
2323
import type { SessionInfo } from "../api/types";
2424
import { examplePrompts } from "../data/examplePrompts";
25-
import { newChatPageUrlStore, newSessionsStore } from "../stores";
25+
import { newSessionsStore } from "../stores";
2626
import { ChatBar, type WalletMeta } from "./ChatBar";
2727
import { type ChatMessage, Chats } from "./Chats";
2828
import { EmptyStateChatPageContent } from "./EmptyStateChatPageContent";
@@ -179,14 +179,6 @@ export function ChatPageContent(props: {
179179
// THIS DOES NOT WORK ANYMORE!! - NEXT JS IS MONKEY PATCHING THIS TOO
180180
// Until we find a better solution, we are just not gonna update the URL
181181
// window.history.replaceState({}, "", `/chat/${sessionId}`);
182-
183-
// if the current page is landing page, link to /chat
184-
// if current page is new /chat page, link to landing page
185-
if (props.type === "landing") {
186-
newChatPageUrlStore.setValue("/chat");
187-
} else {
188-
newChatPageUrlStore.setValue("/");
189-
}
190182
},
191183
[props.type],
192184
);
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"use client";
22

3-
import { useStore } from "@/lib/reactive";
4-
import { newChatPageUrlStore } from "../stores";
3+
import { useSelectedLayoutSegment } from "next/navigation";
54

65
export function useNewChatPageLink() {
7-
const newChatPage = useStore(newChatPageUrlStore);
8-
return newChatPage || "/chat";
6+
const selectedLayout = useSelectedLayoutSegment();
7+
return selectedLayout === "chat" ? "/" : `/chat`
98
}

apps/dashboard/src/app/nebula-app/(app)/stores.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { createStore } from "@/lib/reactive";
22
import type { TruncatedSessionInfo } from "./api/types";
33

4-
export const newChatPageUrlStore = createStore<string | undefined>(undefined);
54

65
export const newSessionsStore = createStore<TruncatedSessionInfo[]>([]);
76

0 commit comments

Comments
 (0)