Skip to content

Commit 96bc1d2

Browse files
committed
Fix proposal uri spamming
1 parent ebc08e9 commit 96bc1d2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/features/governance/ProposalCard.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,23 @@ export const ProposalCard = ({
8383
)?.offsetFromStartTs?.offset ?? new BN(0),
8484
))
8585

86+
const proposalUri = useMemo(() => proposal?.uri, [proposal])
8687
const {
8788
error: descError,
8889
loading: descLoading,
8990
result: desc,
9091
} = useAsync(async () => {
91-
if (proposal && proposal.uri) {
92+
if (proposalUri) {
9293
// Force HTTPS for security - convert any HTTP URLs to HTTPS
93-
const secureUri = proposal.uri.replace(/^http:\/\//, 'https://')
94+
const secureUri = proposalUri.replace(/^http:\/\//, 'https://')
9495
const { data } = await axios.get(secureUri)
9596
const htmlContent = markdownParser.render(data)
9697
const firstParagraphMatch = htmlContent.match(/<p>(.*?)<\/p>/i)
9798
return firstParagraphMatch
9899
? firstParagraphMatch[0].replace(/<[^>]+>/g, '')
99100
: t('gov.proposals.noDescription')
100101
}
101-
}, [proposal])
102+
}, [proposalUri])
102103

103104
const votingResults = useMemo(() => {
104105
const totalVotes: BN = [...(proposal?.choices || [])].reduce(

0 commit comments

Comments
 (0)