question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading status indicator / 'readiness' indicator for `useContract`

See original GitHub issue

Contracts take some time to load. Right now, if someone wrote this:

const greeterContract = useContract(xxx,xxx);

Then greeterContract will go through the following lifecycle:

null          ---->           { } (empty object)        ---->            actual contract object (ready)

Because of that weird empty object state in the middle, just doing

if (!greeterContract)

doesn’t work.

We need to ship an indicator that notifies the user when the contract is ready. Something like:

const [contract, ready] = useContract(___, ___);

// ready becomes true when the contract has finished loading

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
catalin-casuneanucommented, Dec 29, 2021

@Dhaiwat10 Hello! I was blocked for a second by the thought that this is too easy 😅 Anyhow, I made a PR, please review it when you have the time and if there are any improvements that I can make, please let me know. Also, do I need a Changeset?

1reaction
Dhaiwat10commented, Dec 29, 2021

Actually, I think we need a minor bump lol. Sorry for the confusion @CatalinCsnMaster

Read more comments on GitHub >

github_iconTop Results From Across the Web

FIS User Manual - UCSC Financial Affairs
Open invoices with Cancel indicator of "N" have payables re-established. Canceled check number will display until replacement check is issued for re-established ...
Read more >
Contract vs. Spot Rates: What's the Difference in Truckload ...
Shipper's guide to committed freight pricing, when to use spot and how to host an RFP.
Read more >
How to build a Dapp - Interacting with a smart contract using ...
How to interact with your smart contract using React, useDApp and Ethers ?In the first tutorial we made a simple smart contract for...
Read more >
Reserve Component (DJMS-RC) Procedures Manual
Table 2-1: Pay status and active duty codes ... The NPS indicator is “6” for NPS Soldiers and blank for all others.
Read more >
2017 BLM National Aviation Plan
External Load Weight Indicator in cockpit; Wire strike protection system (mechanical);. Two panel-mounted VHF-AM and two panel-mounted VHF-FM radios; One ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found