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

CL add liq: remove legacy pool query & fix CL add liq intro data #3878

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

jonator
Copy link
Member

@jonator jonator commented Oct 8, 2024

What is the purpose of the change:

Closes: FE-1145

Remove legacy mobx pool query and replace with tRPC get pool utilities. Fixes display of some pool data when starting CL add liq flow:

Now:
Screenshot 2024-10-07 at 10 15 50 PM

Prod:
Screenshot 2024-10-07 at 10 16 23 PM

Copy link

vercel bot commented Oct 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
osmosis-frontend ❌ Failed (Inspect) Oct 8, 2024 2:17am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
osmosis-frontend-datadog ⬜️ Ignored (Inspect) Oct 8, 2024 2:17am
osmosis-frontend-dev ⬜️ Ignored (Inspect) Oct 8, 2024 2:17am
osmosis-frontend-edgenet ⬜️ Ignored (Inspect) Oct 8, 2024 2:17am
osmosis-testnet ⬜️ Ignored (Inspect) Oct 8, 2024 2:17am

Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

Walkthrough

The changes in this pull request involve the removal of files and code related to pool fee metrics management. Specifically, the ObservableQueryPoolFeesMetrics class and associated TypeScript interfaces were deleted, along with their references in the QueriesExternalStore class. Additionally, the AddConcLiquidity component was updated to fetch pool data via an API query instead of relying on the removed metrics, altering its data handling and display logic.

Changes

File Path Change Summary
packages/stores/src/queries-external/pool-fees/... Removed index.ts containing ObservableQueryPoolFeesMetrics class and related export statements.
packages/stores/src/queries-external/pool-fees/... Removed types.ts containing PoolFeesMetrics and PoolFees interfaces.
packages/stores/src/queries-external/store.ts Removed queryPoolFeeMetrics property from QueriesExternalStore class.
packages/web/components/complex/add-conc-liquidity.tsx Updated AddConcLiquidity component to use API for pool data, modified imports, and adjusted logic.

Possibly related PRs

Suggested reviewers

  • CryptoAssassin1
  • MaxMillington
  • JoseRFelix

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (1)
packages/web/components/complex/add-conc-liquidity.tsx (1)

Line range hint 574-590: Ensure 'pool.reserveCoins' has the expected structure

When accessing pool.reserveCoins at indices [0] and [1], there's an assumption that the array contains at least two elements. If pool or reserveCoins is undefined or has fewer elements, this could lead to runtime errors. Consider adding checks to ensure pool.reserveCoins has the expected length.

Apply this diff to add safety checks:

- <DepositAmountGroup
-   currency={pool?.reserveCoins[0]?.currency}
+ {pool?.reserveCoins?.[0]?.currency && (
+   <DepositAmountGroup
+     currency={pool.reserveCoins[0].currency}
      ...
+   />
+ )}

...

- <DepositAmountGroup
-   currency={pool?.reserveCoins[1]?.currency}
+ {pool?.reserveCoins?.[1]?.currency && (
+   <DepositAmountGroup
+     currency={pool.reserveCoins[1].currency}
      ...
+   />
+ )}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 34399cc and d44fab7.

📒 Files selected for processing (4)
  • packages/stores/src/queries-external/pool-fees/index.ts (0 hunks)
  • packages/stores/src/queries-external/pool-fees/types.ts (0 hunks)
  • packages/stores/src/queries-external/store.ts (0 hunks)
  • packages/web/components/complex/add-conc-liquidity.tsx (10 hunks)
💤 Files with no reviewable changes (3)
  • packages/stores/src/queries-external/pool-fees/index.ts
  • packages/stores/src/queries-external/pool-fees/types.ts
  • packages/stores/src/queries-external/store.ts
🧰 Additional context used


import { Tooltip } from "../tooltip";

// TODO: don't think these dynamic imports are needed or are set up properly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Address the TODO comment regarding dynamic imports

There is a TODO comment indicating that the dynamic imports may not be needed or are not set up properly. It's important to resolve or remove TODO comments before merging to maintain code quality and avoid potential issues.

If these dynamic imports are unnecessary, consider removing them to optimize performance. If they are required, ensure they are correctly configured.

Comment on lines +74 to 77
const { queriesExternalStore } = useStore();

const { queryQuasarVaults } = queriesExternalStore;
const { vaults: quasarVaults } = queryQuasarVaults.get(poolId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider refactoring 'quasarVaults' data fetching to use API queries

Since you've updated the pool data fetching to use API queries, consider migrating the quasarVaults data fetching to use the same approach. This would reduce dependencies on the MobX store and streamline your data retrieval process.

Would you like assistance in updating quasarVaults fetching to use the API?

Comment on lines +79 to +81
const { data: pool } = api.edge.pools.getPool.useQuery({
poolId,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Handle loading and error states when fetching pool data

Currently, you're extracting data as pool without handling the loading or error states from useQuery. This might lead to unintended behaviors if the data is still loading or if there's an error fetching the pool data. Consider handling isLoading and error states to enhance user experience and prevent potential runtime errors.

Apply this diff to handle loading and error states:

 const {
   data: pool,
+  isLoading,
+  error,
 } = api.edge.pools.getPool.useQuery({
   poolId,
 });
+
+ if (isLoading) {
+   return <Spinner />;
+ }
+
+ if (error) {
+   return <div>Error loading pool data</div>;
+ }

Committable suggestion was skipped due to low confidence.

@jonator jonator merged commit 017f06b into stage Oct 8, 2024
23 of 33 checks passed
@jonator jonator deleted the jon/cl-add-liq branch October 8, 2024 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants