Skip to content

Commit 0ba76fb

Browse files
committed
fix: add refetch functionality to entity details query in OrgDashboardLayout
1 parent 152c8bc commit 0ba76fb

File tree

1 file changed

+20
-10
lines changed
  • app/[locale]/dashboard/[entityType]/[entitySlug]

1 file changed

+20
-10
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/layout.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,26 @@ export default function OrgDashboardLayout({ children }: DashboardLayoutProps) {
2424
const params = useParams<{ entityType: string; entitySlug: string }>();
2525
const { setEntityDetails, entityDetails, userDetails } = useDashboardStore();
2626

27-
const EntityDetailsQryRes: { data: any; isLoading: boolean; error: any } =
28-
useQuery([`entity_details_${params.entityType}`], () =>
29-
GraphQL(
30-
params.entityType === 'organization' && getOrgDetailsQryDoc,
31-
{
32-
[params.entityType]: params.entitySlug,
33-
},
34-
{ slug: params.entitySlug }
35-
)
36-
);
27+
const EntityDetailsQryRes: {
28+
data: any;
29+
isLoading: boolean;
30+
error: any;
31+
refetch: any;
32+
} = useQuery([`entity_details_${params.entityType}`], () =>
33+
GraphQL(
34+
params.entityType === 'organization' && getOrgDetailsQryDoc,
35+
{
36+
[params.entityType]: params.entitySlug,
37+
},
38+
{ slug: params.entitySlug }
39+
)
40+
);
41+
42+
43+
useEffect(() => {
44+
EntityDetailsQryRes.refetch();
45+
}, []);
46+
3747

3848
useEffect(() => {
3949
if (EntityDetailsQryRes.data) {

0 commit comments

Comments
 (0)