Closed AMIRKHANEF closed 2 weeks ago
The changes in this pull request focus on the getReferendumCommentsSS
function, specifically enhancing error handling and modifying the logic of the voteInformation
inner function. The return type of voteInformation
was changed from string
to string | null
, allowing it to return null
when no vote is found. The function's logic was restructured to check for the existence of a vote before accessing its properties, preventing potential runtime errors. Additionally, the mapping of comments was updated to conditionally populate the votes
property based on the results from voteInformation
.
File Path | Change Summary |
---|---|
packages/extension-polkagate/src/fullscreen/governance/utils/helpers.ts | - Updated voteInformation return type from string to string | null . - Restructured logic to check for vote existence before accessing properties. - Modified mapping of votes to conditionally populate based on voteInformation . |
getReferendumCommentsSS
function in the same file as the main PR, enhancing the processing of reactions and ensuring consistency in how reaction data is represented, which is closely related to the changes made in the main PR regarding the structure of comments and votes.🐰 In the land of votes and comments bright,
A function's logic took new flight.
With checks in place, no errors to find,
Clarity and structure, all intertwined.
So hop along, let the changes ring,
For robust code is a wondrous thing! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Close: #1623
Summary by CodeRabbit
Bug Fixes
votes
property is only populated when valid vote information is available.New Features
null
returns when no vote is found.