MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / getHomeViewFromCookie

Function getHomeViewFromCookie

packages/web/src/hooks/useHomeView.ts:10–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8const COOKIE_NAME = HOME_VIEW_COOKIE_NAME;
9
10function getHomeViewFromCookie(): HomeView {
11 if (typeof document === "undefined") {
12 return "search";
13 }
14 const cookies = document.cookie.split(';').map(c => c.trim());
15 const cookie = cookies.find(c => c.startsWith(`${COOKIE_NAME}=`));
16 if (!cookie) {
17 return "search";
18 }
19 const value = cookie.substring(`${COOKIE_NAME}=`.length);
20 return value === "ask" ? "ask" : "search";
21}
22
23function setHomeViewCookie(value: HomeView) {
24 if (typeof document === "undefined") {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected