Git Product home page Git Product logo

Comments (1)

jmrossy avatar jmrossy commented on July 24, 2024

The general approach here is to remove uses of CoreChains from @hyperlane-xyz/registry and instead query the domain table via Hasura's GraphQL API. See below for pics of the domain table.

If the scraped chain list could be retrieved synchronously, this would be an easy change: just swap that in where we currently reach for the registry export. That's not possible here; it will need to be fetched via an async GraphQL query via the urql lib.

There are a few ways to solve this kind of problem in a react app:

  1. Create a new useDatabaseChains() hook which executes a query. Depending on how well urql caches the data, we may need to push that data into the zustand state store.
  2. Add a new wrapper component in _app.ts which suspends the normal app tree until this data is available.
  3. Trigger an effect somewhere that performs a one-off graphql query and places the data either in the store (preferable) or just in some global state somewhere

Either way, given that utils like isPiChain currently assume this data is globally and synchronously available, some refactoring will be needed. Overall, not a small task but not huge either.

Some relevant files:

  • src/features/chains/utils.ts
  • src/components/search/SearchFilterBar.tsx
  • src/store.ts
  • src/features/messages/MessageSearch.tsx
  • src/features/messages/queries/useMessageQuery.ts (for an example of using urql)
Screenshot 2024-07-02 at 2 31 36 PM Screenshot 2024-07-02 at 2 32 18 PM

from hyperlane-explorer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.