@@ -4,7 +4,7 @@ import { useQuery } from '@tanstack/react-query';
44import { Card , Icon , Spinner , Text } from 'opub-ui' ;
55
66import { GraphQL } from '@/lib/api' ;
7- import { cn } from '@/lib/utils' ;
7+ import { cn , extractPublisherId } from '@/lib/utils' ;
88import { Icons } from '@/components/icons' ;
99import { stripMarkdown } from '../../search/components/UnifiedListingComponent' ;
1010
@@ -104,28 +104,27 @@ const organizationPublishedDatasetsDoc: any = graphql(`
104104
105105const Datasets = ( { type } : { type : 'organization' | 'Publisher' } ) => {
106106 const params = useParams ( ) ;
107+ const id = extractPublisherId (
108+ String ( type === 'organization' ? params . organizationSlug : params . publisherSlug )
109+ ) ;
107110
108111 const PublishedDatasetsList : any = useQuery (
109- [
110- type === 'organization'
111- ? `orgPublishedDatasets_${ params . organizationSlug } `
112- : `userPublishedDatasets_${ params . publisherSlug } ` ,
113- ] ,
112+ [ 'publishedDatasets' , type , id ] ,
114113 ( ) =>
115114 type === 'organization'
116115 ? GraphQL (
117116 organizationPublishedDatasetsDoc ,
118117 {
119118 // Entity Headers
120119 } ,
121- { organizationId : params . organizationSlug } // ✅ exact match for expected shape
120+ { organizationId : id } // ✅ exact match for expected shape
122121 )
123122 : GraphQL (
124123 userPublishedDatasetsDoc ,
125124 {
126125 // Entity Headers
127126 } ,
128- { userId : params . publisherSlug } // ✅ exact match for expected shape
127+ { userId : id } // ✅ exact match for expected shape
129128 )
130129 ) ;
131130
0 commit comments