From 5a764d4521e331da59900433ee6535d192cf2e5f Mon Sep 17 00:00:00 2001 From: Vadim Dalecky Date: Wed, 13 Apr 2022 22:17:50 +0200 Subject: [PATCH] fix: stop looping when library is ready --- src/blocks/dropbox/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/blocks/dropbox/index.tsx b/src/blocks/dropbox/index.tsx index 01539170a..680db7f8d 100644 --- a/src/blocks/dropbox/index.tsx +++ b/src/blocks/dropbox/index.tsx @@ -41,7 +41,10 @@ const WithDropbox: React.FC = (props) => { let mounted = true; const wait = () => { if (!mounted) return; - if (typeof Dropbox !== 'undefined') setReady(true); + if (typeof Dropbox !== 'undefined') { + setReady(true); + return; + } setTimeout(wait, 100); }; wait();