Skip to content

Conversation

@shoom3301
Copy link
Collaborator

@shoom3301 shoom3301 commented Dec 25, 2025

Summary

Fixes #6748 (only 1st and 2nd points)

There is a preparation for this PR: #6767

Please, review this PR commit by commit:

  1. Got rid of render functions in RequestCancellationModal. No functional changes, just cleaning of the code. c7962be#diff-3df799ccd7ff9b27678cd609f3a616cec967ff9698a52ad1cf1af309ea9a5e8a
  2. Refactoring of computeOrderSummary in order to simplify it. Again, no functional changes, just getting rid of let. cf33725#diff-5315414acf2e0d3d9c748227b2526fe4f99db49ad92cd642241e9f3420320e4f
  3. Another non-functional refactoring, extracted duplicated code into useGetSerializedBridgeOrder. 1ebc832#diff-09b05a4ab56ccb1f0bc18d6e98e98373c670f37d9c0e7dc485b8dd6630c2ae51
  4. The first functional change. As ypu might remember, computeOrderSummary doesn't support bridge orders. In this commit I added bridgeOrderFromStore and bridgeOrderFromApi properties. First one is used when bridging order is pending, another one when it's filled. 0c70318#diff-5315414acf2e0d3d9c748227b2526fe4f99db49ad92cd642241e9f3420320e4f
  5. Since now computeOrderSummary supports bridging orders, we wire up them with components where order summary is rendered: ActivityDetails and CancellationModal. 8f4a80e
  6. Fix for 2nd point of Near: handle amounts on cancelled/expired swap and bridge orders #6748. We've been set isBridgeOrder when order is cancelled, but this is not correct because we use isBridgeOrder in useSwapAndBridgeContext(). That hook returns an intermediate token of the order, which is needed to render amounts. 9334831

To Test

1st and 2nd points of #6748

Summary by CodeRabbit

  • Refactor

    • Restructured order cancellation modal to improve maintainability and separation of concerns
    • Enhanced order data aggregation to consolidate information from multiple sources
    • Optimized bridge order data retrieval mechanisms
    • Improved order summary computation logic for better accuracy
  • Tests

    • Added comprehensive unit tests for order summary rendering across various order types and scenarios

✏️ Tip: You can customize this high-level summary in your review settings.

@shoom3301 shoom3301 requested review from a team December 25, 2025 11:49
@shoom3301 shoom3301 self-assigned this Dec 25, 2025
@vercel
Copy link

vercel bot commented Dec 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
cowfi Ready Ready Preview Dec 30, 2025 8:25am
explorer-dev Ready Ready Preview Dec 30, 2025 8:25am
swap-dev Building Building Preview Dec 30, 2025 8:25am
widget-configurator Ready Ready Preview Dec 30, 2025 8:25am
2 Skipped Deployments
Project Deployment Review Updated (UTC)
cosmos Ignored Ignored Dec 30, 2025 8:25am
sdk-tools Ignored Ignored Preview Dec 30, 2025 8:25am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 25, 2025

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between f10b94a and 75a02ed.

📒 Files selected for processing (19)
  • apps/cowswap-frontend/src/common/containers/CancellationModal/index.tsx
  • apps/cowswap-frontend/src/common/containers/MultipleOrdersCancellationModal/index.tsx
  • apps/cowswap-frontend/src/common/hooks/useCancelOrder/index.ts
  • apps/cowswap-frontend/src/common/hooks/useUltimateOrder.ts
  • apps/cowswap-frontend/src/common/pure/CancellationModal/ModalTopContent.tsx
  • apps/cowswap-frontend/src/common/pure/CancellationModal/RequestCancellationModal.cosmos.tsx
  • apps/cowswap-frontend/src/common/pure/CancellationModal/RequestCancellationModal.tsx
  • apps/cowswap-frontend/src/common/pure/CancellationModal/types.ts
  • apps/cowswap-frontend/src/common/updaters/orders/CancelledOrdersUpdater.ts
  • apps/cowswap-frontend/src/common/updaters/orders/PendingOrdersUpdater.ts
  • apps/cowswap-frontend/src/common/updaters/orders/utils.test.ts
  • apps/cowswap-frontend/src/common/updaters/orders/utils.ts
  • apps/cowswap-frontend/src/entities/bridgeOrders/hooks/useCrossChainOrder.ts
  • apps/cowswap-frontend/src/entities/bridgeOrders/hooks/useGetSerializedBridgeOrder.ts
  • apps/cowswap-frontend/src/entities/bridgeOrders/index.ts
  • apps/cowswap-frontend/src/legacy/components/CowSubsidyModal/index.tsx
  • apps/cowswap-frontend/src/legacy/components/TransactionConfirmationModal/LegacyConfirmationModalContent.tsx
  • apps/cowswap-frontend/src/locales/en-US.po
  • apps/cowswap-frontend/src/modules/account/containers/Transaction/ActivityDetails.tsx
 __________________________
< // TODO: Find more bugs. >
 --------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting in your project's settings in CodeRabbit to disable sequence diagrams in the walkthrough.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

Hey @shoom3301 , overall, great job! Looks way better for cancellations amounts.

However, I have some questions to clarify:

  1. AFAIU, 'recipient' will be removed a bit later from all these messages. correct?
Screenshot_16
  1. If you so, could you please add a receiver if it was specified for a swap and bridge order? E.g. here I specified a custom recipient
image but the modals/pop-up shows me a wrong one. sey

Or it should be fixed here?

  1. I'm a bit confused with amounts. I see one 'TO' amount on the progress bar, and another one on the cancelled pop-up. I understand where this amount comes from, however, not sure what is the best option here: leave it as it is or still show an 'initial amount' for bridge, as users placed a bridge order.
    I loke more the 2nd option, how is it difficult to implement?
confusion

Thank you!

Copy link
Contributor

@limitofzero limitofzero left a comment

Choose a reason for hiding this comment

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

image looks good from my prospective, just one comment

@shoom3301
Copy link
Collaborator Author

@elena-zh thanks!
I addressed the issues in the next PR: #6773

Base automatically changed from refactor/order-summary to develop December 30, 2025 08:18
… refactor/order-summary-1

# Conflicts:
#	apps/cowswap-frontend/src/common/containers/CancellationModal/index.tsx
#	apps/cowswap-frontend/src/common/pure/CancellationModal/RequestCancellationModal.tsx
#	apps/cowswap-frontend/src/common/updaters/orders/utils.ts
#	apps/cowswap-frontend/src/modules/account/containers/Transaction/ActivityDetails.tsx
@shoom3301 shoom3301 merged commit d09b211 into develop Dec 30, 2025
11 of 16 checks passed
@shoom3301 shoom3301 deleted the refactor/order-summary-1 branch December 30, 2025 08:25
@github-actions github-actions bot locked and limited conversation to collaborators Dec 30, 2025
@shoom3301
Copy link
Collaborator Author

@elena-zh please continue testing in #6773

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Near: handle amounts on cancelled/expired swap and bridge orders

5 participants