DigixGlobal / governance-ui-components

Governance UI reusable components library
Other
3 stars 2 forks source link

[FIX] Added checks on 'finalReward' so it won't be rendered 'undefined' #375

Closed Daivasmara closed 5 years ago

Daivasmara commented 5 years ago

Description

Ref: DGDG-582

This PR is another attempt at fixing the issue on the users having a white screen of the death when viewing a proposal.

The log appearing on the console:

Failed to load resource: the server responded with a status of 404 ()
www.google-analytics.com/analytics.js:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
static.zdassets.com/web_widget/latest/common_vendor.eb3555beadc8d02cdc54.js:1 Our embeddable contains third-party, open source software and/or libraries. To view them and their license terms, go to http://goto.zendesk.com/embeddable-legal-notices
main.57a53be343ac5630d012.js:1 WebSocket connection to 'wss://info.digix.global/websocket' failed: WebSocket is closed before the connection is established.
value @ main.57a53be343ac5630d012.js:1
/vendor.24fa41b2294ad394225d.js:180 TypeError: Cannot read property 'finalReward' of undefined
    at t.value (/main.57a53be343ac5630d012.js:1)
    at Ca (/vendor.24fa41b2294ad394225d.js:180)
    at xa (/vendor.24fa41b2294ad394225d.js:180)
...
uo @ /vendor.24fa41b2294ad394225d.js:180
/vendor.24fa41b2294ad394225d.js:237 Uncaught TypeError: Cannot read property 'finalReward' of undefined
    at t.value (/main.57a53be343ac5630d012.js:1)
    at Ca (/vendor.24fa41b2294ad394225d.js:180)
...

the finalReward is being displayed on the funding tab:

funding

the finalReward coming from the graphql:

network

What i did

I make sure the javascript event loop is not stuck on looping because finalReward is undefined, therefore it should prevent the white screen appearing, with just simple if (typeof).

Types of changes

Checklist: