Skip to content

Commit 03f3848

Browse files
authored
Merge pull request #988 from aoki-atsushi/fix-empty-languageTabs-bug
chore: Fix bug in CodeSnippets component
2 parents 4e771d3 + 7dfa13b commit 03f3848

File tree

1 file changed

+2
-1
lines changed
  • packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets

1 file changed

+2
-1
lines changed

packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function CodeSnippets({ postman, codeSamples }: Props) {
180180
]);
181181
// no dependencies was intentionlly set for this particular hook. it's safe as long as if conditions are set
182182
useEffect(function onSelectedVariantUpdate() {
183-
if (selectedVariant && selectedVariant !== language.variant) {
183+
if (selectedVariant && selectedVariant !== language?.variant) {
184184
const postmanRequest = buildPostmanRequest(postman, {
185185
queryParams,
186186
pathParams,
@@ -211,6 +211,7 @@ function CodeSnippets({ postman, codeSamples }: Props) {
211211
// eslint-disable-next-line react-hooks/exhaustive-deps
212212
useEffect(function onSelectedSampleUpdate() {
213213
if (
214+
language &&
214215
language.samples &&
215216
language.samplesSources &&
216217
selectedSample &&

0 commit comments

Comments
 (0)