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

fix: Update limit price on refresh #2723

Merged
merged 3 commits into from
Sep 27, 2023
Merged

Conversation

jorbuedo
Copy link
Contributor

@jorbuedo jorbuedo commented Sep 27, 2023

@jorbuedo jorbuedo added the fix label Sep 27, 2023
@jorbuedo jorbuedo self-assigned this Sep 27, 2023
Copy link
Contributor

@SorinC6 SorinC6 left a comment

Choose a reason for hiding this comment

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

@jorbuedo have tried locally and something seems of as is not updating the price 🤔 have added more logic on this issue in #2722

@stackchain
Copy link
Member

@jorbuedo have tried locally and something seems of as is not updating the price 🤔 have added more logic on this issue in #2722

@SorinC6 @jorbuedo I've brought the changes

@jorbuedo
Copy link
Contributor Author

jorbuedo commented Sep 27, 2023

@SorinC6 @stackchain pretty sure #2722 is wrong

asQuantity(formattedValue)

Is not ok. Formatted value can't be passed to asQuantity.

<AmountInput onChange={onChange} value={createOrder.limitPrice} editable={!disabled} />

createOrder.limitPrice is not directly assignable to the input

And

    {
      onSuccess: (poolList: Swap.Pool[]) => {
        const bestPool: Swap.Pool | undefined = poolList
          .sort((a: Swap.Pool, b: Swap.Pool) => a.price - b.price)
          .find(() => true)
        if (bestPool !== undefined) {
          const defaultPrice = createOrder.marketPrice
          const formattedValue = BigNumber(defaultPrice).decimalPlaces(PRECISION).toFormat(numberLocale)
          selectedPoolChanged(bestPool)
          limitPriceChanged(asQuantity(formattedValue))
        }
      },
    },

None of that should be modified from here. The pool change is already done on createOrder, and again limitPriceChanged can't receive that.

@stackchain stackchain force-pushed the fix-refresh-limit-price branch from ad05ded to 126efb2 Compare September 27, 2023 17:41
@stackchain stackchain added this to the 5.0.0 milestone Sep 27, 2023
@jorbuedo
Copy link
Contributor Author

@stackchain now it should work

@jorbuedo
Copy link
Contributor Author

Passing tests, the ultimate frontier

@jorbuedo
Copy link
Contributor Author

fixes https://emurgo.atlassian.net/browse/YOMO-811 as well

@jorbuedo jorbuedo requested a review from SorinC6 September 27, 2023 18:05
@stackchain stackchain merged commit b8e3f84 into develop Sep 27, 2023
@stackchain stackchain deleted the fix-refresh-limit-price branch September 27, 2023 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants