From 34e84e8b83764f472184c079a09a604f06e80cf9 Mon Sep 17 00:00:00 2001 From: HuaZhuangNan Date: Fri, 3 Nov 2023 14:10:57 +0800 Subject: [PATCH] Update google-translate-select.tsx fix react project options is not find https://github.com/i7eo/google-translate-select/issues/78 --- packages/react/src/google-translate-select.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react/src/google-translate-select.tsx b/packages/react/src/google-translate-select.tsx index dd0e7fe..f10a9ad 100644 --- a/packages/react/src/google-translate-select.tsx +++ b/packages/react/src/google-translate-select.tsx @@ -319,11 +319,12 @@ export default function GoogleTranslateSelect(props: IGoogleTranslateProps) { const selectValue = isString(select) ? select : select.value ?? '' const googleTranslateOriginalSelectEl = document.querySelector( GOOGLE_TRANSLATE_ORIGINAL_SELECT_CLASSNAME - ) as HTMLSelectElement + ) as HTMLSelectElement | null const googleTranslateSelectEl = document.querySelector(`.${ns.b()}`) if ( !googleTranslateSelectEl || + !googleTranslateOriginalSelectEl || googleTranslateSelectEl.innerHTML.length === 0 || googleTranslateOriginalSelectEl.options.length === 0 ) {