Skip to content

Commit

Permalink
Fix: move getting resource version children to a function (#3244)
Browse files Browse the repository at this point in the history
  • Loading branch information
musale authored Jul 9, 2024
1 parent 6e4266c commit d46a9f3
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ const SuffixRenderer = () => {

const getDocumentationLink = (): string | null => {
const { queries } = samples;

const getChildren = ()=> {
if (resources.data && Object.keys(resources.data).length > 0 && sampleQuery.selectedVersion in resources.data){
return resources.data[sampleQuery.selectedVersion].children ?? [];
}
return [];
}
const resourceDocumentationUrl = new DocumentationService({
sampleQuery,
source: Object.keys(resources.data).length > 0 ?
resources.data[sampleQuery.selectedVersion].children! : []
source: getChildren()
}).getDocumentationLink();

const sampleDocumentationUrl = new DocumentationService({
Expand Down

0 comments on commit d46a9f3

Please sign in to comment.