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

[Limit Orders]: Feature Flag for SQS Active Orders #3837

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

crnbarr93
Copy link
Contributor

What is the purpose of the change:

These changes add integration of an sqsActiveOrders feature flag that can enable/disable the use of the SQS passthrough query.

Brief Changelog

  • Active and Claimable orders query enable/disable depending on feature flag status

Testing and Verifying

Tested locally using launch darkly UI to toggle feature flag on and off

@crnbarr93 crnbarr93 requested a review from a team September 10, 2024 10:19
Copy link

vercel bot commented Sep 10, 2024

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

Name Status Preview Comments Updated (UTC)
osmosis-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 10, 2024 10:24am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
osmosis-frontend-datadog ⬜️ Ignored (Inspect) Sep 10, 2024 10:24am
osmosis-frontend-dev ⬜️ Ignored (Inspect) Sep 10, 2024 10:24am
osmosis-frontend-edgenet ⬜️ Ignored (Inspect) Sep 10, 2024 10:24am
osmosis-testnet ⬜️ Ignored (Inspect) Sep 10, 2024 10:24am

Copy link
Contributor

coderabbitai bot commented Sep 10, 2024

Walkthrough

The pull request introduces modifications to the refetchInterval parameters in the useOrderbookAllActiveOrders and useOrderbookClaimableOrders hooks, allowing for dynamic adjustments based on a new feature flag, sqsActiveOrders. Additionally, the hooks are updated to conditionally query either SQS or a direct node endpoint based on this feature flag. The use-feature-flags.ts file is also updated to include the new flag, enhancing feature management capabilities within the application.

Changes

Files Change Summary
packages/web/components/complex/orders-history/index.tsx Modified refetchInterval in useOrderbookAllActiveOrders and useOrderbookClaimableOrders to be conditional based on featureFlags.sqsActiveOrders.
packages/web/hooks/limit-orders/use-orderbook.ts Introduced useOrdersQuery and useClaimableOrdersQuery functions for SQS or direct node querying based on sqsActiveOrders. Updated internal logic of hooks while keeping signatures unchanged.
packages/web/hooks/use-feature-flags.ts Added sqsActiveOrders to AvailableFlags and updated defaultFlags to initialize it as false.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant OrderHistory
    participant useOrderbookAllActiveOrders
    participant useOrderbookClaimableOrders
    participant SQS
    participant Node

    User->>OrderHistory: Load Order History
    OrderHistory->>useOrderbookAllActiveOrders: Call with refetchInterval
    alt sqsActiveOrders is true
        useOrderbookAllActiveOrders->>SQS: Query for active orders
    else sqsActiveOrders is false
        useOrderbookAllActiveOrders->>Node: Query for active orders
    end
    useOrderbookAllActiveOrders-->>OrderHistory: Return active orders

    OrderHistory->>useOrderbookClaimableOrders: Call with refetchInterval
    alt sqsActiveOrders is true
        useOrderbookClaimableOrders->>SQS: Query for claimable orders
    else sqsActiveOrders is false
        useOrderbookClaimableOrders->>Node: Query for claimable orders
    end
    useOrderbookClaimableOrders-->>OrderHistory: Return claimable orders
Loading

Tip

Announcements
  • The review status is no longer posted as a separate comment when there are no actionable or nitpick comments. In such cases, the review status is included in the walkthrough comment.
  • We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs: Walkthrough comment now includes a list of potentially related PRs to help you recall past context. Please share any feedback in the discussion post on our Discord.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs in the walkthrough comment. You can also provide custom labeling instructions in the UI or configuration file.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0c33b44 and 4ef1fdd.

Files selected for processing (3)
  • packages/web/components/complex/orders-history/index.tsx (2 hunks)
  • packages/web/hooks/limit-orders/use-orderbook.ts (9 hunks)
  • packages/web/hooks/use-feature-flags.ts (3 hunks)
Additional comments not posted (6)
packages/web/hooks/use-feature-flags.ts (1)

33-34: LGTM!

The changes to introduce a new feature flag sqsActiveOrders are approved. The flag has been added to the AvailableFlags type and initialized with a default value of false in the defaultFlags object.

Also applies to: 60-60

packages/web/hooks/limit-orders/use-orderbook.ts (4)

Line range hint 364-402: LGTM!

The code changes to use the new useOrdersQuery function are approved.


Line range hint 478-532: LGTM!

The code changes to use the new useClaimableOrdersQuery function are approved.


Line range hint 409-476: LGTM, but verify the function usage.

The useClaimableOrdersQuery function changes are approved.

However, ensure that this change is thoroughly tested to confirm that it behaves as expected and that all function calls to useClaimableOrdersQuery have been updated to handle the new return structure.

Run the following script to verify the function usage:

Verification successful

Function usage verified successfully.

The useClaimableOrdersQuery function is used correctly within the same file where it is defined. The return structure is handled appropriately, and there are no issues with its usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `useClaimableOrdersQuery` handle the new return structure.

# Test: Search for the function usage. Expect: No incorrect usage.
rg --type typescript -A 5 $'useClaimableOrdersQuery'

Length of output: 86


Script:

#!/bin/bash
# Description: Verify all function calls to `useClaimableOrdersQuery` handle the new return structure.

# Test: Search for the function usage without specifying the file type.
rg -A 5 'useClaimableOrdersQuery'

Length of output: 871


Line range hint 270-362: LGTM, but verify the function usage.

The useOrdersQuery function changes are approved.

However, ensure that this change is thoroughly tested to confirm that it behaves as expected and that all function calls to useOrdersQuery have been updated to handle the new return structure.

Run the following script to verify the function usage:

Verification successful

Function usage verified and correct.

The useOrdersQuery function is used correctly within the same file where it is defined. The parameters and return structure are handled appropriately. No issues were found in its usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `useOrdersQuery` handle the new return structure.

# Test: Search for the function usage. Expect: No incorrect usage.
rg --type typescript -A 5 $'useOrdersQuery'

Length of output: 77


Script:

#!/bin/bash
# Description: Verify all function calls to `useOrdersQuery` handle the new return structure.

# Test: Search for the function usage. Expect: No incorrect usage.
rg --type ts -A 5 $'useOrdersQuery'

Length of output: 919

packages/web/components/complex/orders-history/index.tsx (1)

87-87: LGTM!

The changes to conditionally assign the refetchInterval parameter based on the sqsActiveOrders feature flag are approved. This allows for more dynamic behavior and could enhance performance and resource management depending on the application's state.

Also applies to: 126-126


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

@mattupham mattupham merged commit d1af6ad into stage Sep 10, 2024
33 checks passed
@mattupham mattupham deleted the connor/sqs-orders-ff branch September 10, 2024 16:38
mattupham added a commit that referenced this pull request Sep 10, 2024
* Mattupham/fe 1067 portfolio v3 update 0 change values to be green and up (#3823)

* add threshold updates

* Clean up logs

* [Limit Orders]: SQS Active Order Query (#3828)

* fix: increased cache time and refetch interval for active orders

* fix: even longer cache

* fix: WIP batch query implementation

* fix: longer delay between batches

* fix: batch size/timing

* fix: vercel max duration

* fix: wired in sqs query for active orders

* fix: build

* fix: filled orders styling

* fix: remove claimable orders test data

* fix: further reduced queries

* feat: moved orders query to passthrough

* fix: moved active orders to local router

* fix: altered orders cache to be more responsive

* chore: post typing fixes for active orders sqs query

* fix: reverted unnecessary changes

* feat: removed pool restriction on orderbooks

* Clean up formatter (#3829)

* Clean up formatter

* Remove log

* update no price data

* add pr notification yaml (#3830)

Co-authored-by: Michael Millington <>

* fix lint issue (#3832)

* Handle PricePretty and Lint issue

* add search from query param for earn (#3836)

* Update search from query param

* Do not log subsequent chart interaction events / Handle last event tracking (#3834)

* Handle last event tracking

* Clean up

* Clean up types

* Update event properties

* Add types for event options

* Fix lint

* Update MATIC -> POL (#3835)

* Update MATIC -> POL

* Update tests

* feat: feature flag for sqs active orders (#3837)

* [Limit Orders]: Fix date display for order history (#3833)

* fix: date display for order history

* fix: undid feature flag changes

* fix: typing issue

* [Limit Orders]: Price to Tick Crash Handler (#3838)

* fix: price to tick error handling

* feat: added swap source to swap amplitude events

---------

Co-authored-by: Matt Upham <[email protected]>

* Update IBC overrides to use POL (#3839)

---------

Co-authored-by: Matt Upham <[email protected]>
Co-authored-by: Connor Barr <[email protected]>
Co-authored-by: Max Millington <[email protected]>
mattupham added a commit that referenced this pull request Sep 18, 2024
* Mattupham/fe 1067 portfolio v3 update 0 change values to be green and up (#3823)

* add threshold updates

* Clean up logs

* [Limit Orders]: SQS Active Order Query (#3828)

* fix: increased cache time and refetch interval for active orders

* fix: even longer cache

* fix: WIP batch query implementation

* fix: longer delay between batches

* fix: batch size/timing

* fix: vercel max duration

* fix: wired in sqs query for active orders

* fix: build

* fix: filled orders styling

* fix: remove claimable orders test data

* fix: further reduced queries

* feat: moved orders query to passthrough

* fix: moved active orders to local router

* fix: altered orders cache to be more responsive

* chore: post typing fixes for active orders sqs query

* fix: reverted unnecessary changes

* feat: removed pool restriction on orderbooks

* Clean up formatter (#3829)

* Clean up formatter

* Remove log

* update no price data

* add pr notification yaml (#3830)

Co-authored-by: Michael Millington <>

* fix lint issue (#3832)

* Handle PricePretty and Lint issue

* add search from query param for earn (#3836)

* Update search from query param

* Do not log subsequent chart interaction events / Handle last event tracking (#3834)

* Handle last event tracking

* Clean up

* Clean up types

* Update event properties

* Add types for event options

* Fix lint

* Update MATIC -> POL (#3835)

* Update MATIC -> POL

* Update tests

* feat: feature flag for sqs active orders (#3837)

* [Limit Orders]: Fix date display for order history (#3833)

* fix: date display for order history

* fix: undid feature flag changes

* fix: typing issue

* [Limit Orders]: Price to Tick Crash Handler (#3838)

* fix: price to tick error handling

* feat: added swap source to swap amplitude events

---------



* Update IBC overrides to use POL (#3839)

---------

Co-authored-by: Jon Ator <[email protected]>
Co-authored-by: yakuramori <[email protected]>
Co-authored-by: Connor Barr <[email protected]>
Co-authored-by: Max Millington <[email protected]>
mattupham added a commit that referenced this pull request Sep 18, 2024
* Mattupham/fe 1067 portfolio v3 update 0 change values to be green and up (#3823)

* add threshold updates

* Clean up logs

* [Limit Orders]: SQS Active Order Query (#3828)

* fix: increased cache time and refetch interval for active orders

* fix: even longer cache

* fix: WIP batch query implementation

* fix: longer delay between batches

* fix: batch size/timing

* fix: vercel max duration

* fix: wired in sqs query for active orders

* fix: build

* fix: filled orders styling

* fix: remove claimable orders test data

* fix: further reduced queries

* feat: moved orders query to passthrough

* fix: moved active orders to local router

* fix: altered orders cache to be more responsive

* chore: post typing fixes for active orders sqs query

* fix: reverted unnecessary changes

* feat: removed pool restriction on orderbooks

* Clean up formatter (#3829)

* Clean up formatter

* Remove log

* update no price data

* add pr notification yaml (#3830)

Co-authored-by: Michael Millington <>

* fix lint issue (#3832)

* Handle PricePretty and Lint issue

* add search from query param for earn (#3836)

* Update search from query param

* Do not log subsequent chart interaction events / Handle last event tracking (#3834)

* Handle last event tracking

* Clean up

* Clean up types

* Update event properties

* Add types for event options

* Fix lint

* Update MATIC -> POL (#3835)

* Update MATIC -> POL

* Update tests

* feat: feature flag for sqs active orders (#3837)

* [Limit Orders]: Fix date display for order history (#3833)

* fix: date display for order history

* fix: undid feature flag changes

* fix: typing issue

* [Limit Orders]: Price to Tick Crash Handler (#3838)

* fix: price to tick error handling

* feat: added swap source to swap amplitude events

---------

Co-authored-by: Matt Upham <[email protected]>

* Update IBC overrides to use POL (#3839)

* fix: date display for active orders from node (#3840)

* Mattupham/fe 1077 v26 fe tasks (#3843)

* feat: adding ledger support to 1CT

* fix: make hash optional for TransactionRow type

* Add timeout

* Update default timeout height offset

* Update OSMOSIS_COMMIT_HASH

* Revert "(1CT) Add Ledger Coming Soon Copy (#3554)"

This reverts commit 94f041a.

* Remove ledger paragraph

* Clean up paragraph spacing

* Update protos

* Temp commit - snapshot of working progress

* Update 1ct session allowed functions

* get feature flags ready for launch

* Clean up for launch

* remove log

* Fix type issues related to telescope

---------

Co-authored-by: ghost <[email protected]>

* Less alerts from claim workflow (#3845)

* Publish Stage (#3831) (#3846)

* Mattupham/fe 1067 portfolio v3 update 0 change values to be green and up (#3823)

* add threshold updates

* Clean up logs

* [Limit Orders]: SQS Active Order Query (#3828)

* fix: increased cache time and refetch interval for active orders

* fix: even longer cache

* fix: WIP batch query implementation

* fix: longer delay between batches

* fix: batch size/timing

* fix: vercel max duration

* fix: wired in sqs query for active orders

* fix: build

* fix: filled orders styling

* fix: remove claimable orders test data

* fix: further reduced queries

* feat: moved orders query to passthrough

* fix: moved active orders to local router

* fix: altered orders cache to be more responsive

* chore: post typing fixes for active orders sqs query

* fix: reverted unnecessary changes

* feat: removed pool restriction on orderbooks

* Clean up formatter (#3829)

* Clean up formatter

* Remove log

* update no price data

* add pr notification yaml (#3830)

Co-authored-by: Michael Millington <>

* fix lint issue (#3832)

* Handle PricePretty and Lint issue

* add search from query param for earn (#3836)

* Update search from query param

* Do not log subsequent chart interaction events / Handle last event tracking (#3834)

* Handle last event tracking

* Clean up

* Clean up types

* Update event properties

* Add types for event options

* Fix lint

* Update MATIC -> POL (#3835)

* Update MATIC -> POL

* Update tests

* feat: feature flag for sqs active orders (#3837)

* [Limit Orders]: Fix date display for order history (#3833)

* fix: date display for order history

* fix: undid feature flag changes

* fix: typing issue

* [Limit Orders]: Price to Tick Crash Handler (#3838)

* fix: price to tick error handling

* feat: added swap source to swap amplitude events

---------



* Update IBC overrides to use POL (#3839)

---------

Co-authored-by: Jon Ator <[email protected]>
Co-authored-by: yakuramori <[email protected]>
Co-authored-by: Connor Barr <[email protected]>
Co-authored-by: Max Millington <[email protected]>

---------

Co-authored-by: Matt Upham <[email protected]>
Co-authored-by: Connor Barr <[email protected]>
Co-authored-by: ghost <[email protected]>
Co-authored-by: yakuramori <[email protected]>
Co-authored-by: Jon Ator <[email protected]>
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