From 2495bbd97f8401588f836eaf9b5690154ef8cf50 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 17 Jun 2021 19:20:27 +0200 Subject: [PATCH] bug fixed with requests to BSC SCAN --- .../Spaces/User-Profile-Space/UserProfile.js | 4 +-- UI/Utilities.js | 36 ++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js index 1a5425677..0dce00174 100644 --- a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js +++ b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js @@ -14,7 +14,8 @@ function newGovernanceUserProfileSpace() { thisObject.container.initialize(MODULE_NAME) thisObject.container.isDraggeable = false - waitingForResponses = 0 + let waitingForResponses = 0 + let timer = 0 return thisObject @@ -47,7 +48,6 @@ function newGovernanceUserProfileSpace() { We will get all the user Profiles tokens from the blockchain, making a call every 5 seconds so as not to exceed the rate limit. */ - let timer = 0 for (let i = 0; i < userProfiles.length; i++) { let userProfile = userProfiles[i] if (userProfile.payload === undefined) { continue } diff --git a/UI/Utilities.js b/UI/Utilities.js index eab199c2a..77231f851 100644 --- a/UI/Utilities.js +++ b/UI/Utilities.js @@ -107,27 +107,31 @@ function newUniqueId() { } function splitTextIntoPhrases(text, wordsPerLine) { - let splittedLabel = text.split(' ') - let phrases = [] - let phrase = '' - let wordCount = 0 - for (let i = 0; i < splittedLabel.length; i++) { - phrase = phrase + splittedLabel[i] - wordCount++ + try { + let splittedLabel = text.split(' ') + let phrases = [] + let phrase = '' + let wordCount = 0 + for (let i = 0; i < splittedLabel.length; i++) { + phrase = phrase + splittedLabel[i] + wordCount++ - if (i < splittedLabel.length - 1 && wordCount < wordsPerLine) { - phrase = phrase + ' ' + if (i < splittedLabel.length - 1 && wordCount < wordsPerLine) { + phrase = phrase + ' ' + } + if (wordCount >= wordsPerLine) { + phrases.push(phrase) + phrase = '' + wordCount = 0 + } } - if (wordCount >= wordsPerLine) { + if (wordCount > 0) { phrases.push(phrase) - phrase = '' - wordCount = 0 } + return phrases + } catch (err) { + console.log(err.stack) } - if (wordCount > 0) { - phrases.push(phrase) - } - return phrases } function getTextWidth(text) {