Skip to content

Commit

Permalink
Use hub hostname, not editor page hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
janbaykara committed Jul 29, 2024
1 parent 9127fad commit 86444ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion nextjs/src/components/hub/HubPageEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ export default function HubPageEditor({ hubId, pageId }: { hubId: string, pageId
input: {
puckJsonContent: data
}
}
},
refetchQueries: [
"GetHubHomepageJson"
]
})

toastPromise(p, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FilterableGridProps, FilterableGridRenderer } from "../FilterableGrid";
import { gql, useQuery } from "@apollo/client";
import { LoadingIcon } from "@/components/ui/loadingIcon";
import { GetHubHomepageJsonQuery, GetHubHomepageJsonQueryVariables } from "@/__generated__/graphql";
import { useHubRenderContext } from "@/components/hub/HubRenderContext";

// TODO:
export type HomepageItemsAliasProps = {}
Expand All @@ -22,11 +23,13 @@ export const HomepageItemsAlias: ComponentConfig<HomepageItemsAliasProps> = {
};

const HomepageItemsAliasRenderer = () => {
const hubContext = useHubRenderContext()

const data = useQuery<GetHubHomepageJsonQuery, GetHubHomepageJsonQueryVariables>(GET_HUB_HOMEPAGE_JSON, {
variables: {
hostname: typeof window !== 'undefined' ? window.location.hostname : ''
hostname: hubContext.hostname
},
skip: typeof window === 'undefined'
skip: !hubContext.hostname
})

const puckData = data.data?.hubPageByPath?.puckJsonContent as Data<FilterableGridProps>
Expand Down

0 comments on commit 86444ad

Please sign in to comment.