Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch CoreChains dynamically from the DB domains table #74

Closed
Tracked by #166
jmrossy opened this issue May 17, 2024 · 1 comment · Fixed by #106
Closed
Tracked by #166

Fetch CoreChains dynamically from the DB domains table #74

jmrossy opened this issue May 17, 2024 · 1 comment · Fixed by #106
Assignees

Comments

@jmrossy
Copy link
Collaborator

jmrossy commented May 17, 2024

Currently it imports CoreChains from the Registry lib to determine if scraped. It would be better to query the DB for this information.

Once this is done, remove the hard-coded CoreChains list from the registry as it's no longer needed.

https://discord.com/channels/935678348330434570/935678739663192184/1241041835976294442

@jmrossy jmrossy self-assigned this May 17, 2024
@jmrossy jmrossy moved this to Backlog in Hyperlane Tasks May 17, 2024
@jmrossy jmrossy moved this from Backlog to Next Sprint in Hyperlane Tasks Jun 6, 2024
@avious00 avious00 moved this from Next Sprint to Sprint in Hyperlane Tasks Jun 16, 2024
@avious00 avious00 assigned paulbalaji and unassigned jmrossy Jul 1, 2024
@jmrossy
Copy link
Collaborator Author

jmrossy commented Jul 2, 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

@paulbalaji paulbalaji assigned jmrossy and unassigned paulbalaji Jul 15, 2024
@jmrossy jmrossy moved this from Sprint to In Progress in Hyperlane Tasks Aug 27, 2024
@jmrossy jmrossy moved this from In Progress to In Review in Hyperlane Tasks Aug 27, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in Hyperlane Tasks Aug 28, 2024
@jmrossy jmrossy removed this from Hyperlane Tasks Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants