Skip to content

Commit

Permalink
fix default uuid check
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-agenta committed Nov 22, 2024
1 parent 7bdcb18 commit 3169d8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions agenta-web/src/contexts/app.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {dynamicContext} from "@/lib/helpers/dynamic"
import {HookAPI} from "antd/es/modal/useModal"
import {useLocalStorage} from "usehooks-ts"
import {useProfileData} from "./profile.context"
import {useProjectData} from "./project.context"
import {useProjectData, DEFAULT_UUID} from "./project.context"

type AppContextType = {
currentApp: ListAppsItem | null
Expand Down Expand Up @@ -42,11 +42,13 @@ const useApps = () => {
})
}, [])

const isMockProjectId = projectId === DEFAULT_UUID

const {selectedOrg, loading} = useOrgData()
const {data, error, isLoading, mutate} = useSWR(
!!user
? `${getAgentaApiUrl()}/api/apps?` +
(!!projectId ? `project_id=${projectId}&` : "") +
(!isMockProjectId ? `project_id=${projectId}&` : "") +
(isDemo() ? `workspace_id=${selectedOrg?.default_workspace.id}&` : "") +
(isDemo() ? `org_id=${selectedOrg?.id}&` : "")
: null,
Expand Down
2 changes: 1 addition & 1 deletion agenta-web/src/contexts/project.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useStateCallback from "@/hooks/useStateCallback"
import {dynamicContext} from "@/lib/helpers/dynamic"
import {isDemo} from "@/lib/helpers/utils"

const DEFAULT_UUID = null
export const DEFAULT_UUID = "00000000-0000-0000-0000-000000000000"

type Project = {
workspace_id: string | null
Expand Down

0 comments on commit 3169d8c

Please sign in to comment.