Comments (1)
Proposal
Please re-state the problem we are trying to solve
Clicking on the paypal payment option more than once causes the 'Edit' option to go away.
What is the root cause of the problem?
In BasePaymentsPage.js
the edit option is only shown if the selected option is of type CONST.PAYMENT_METHODS.PAYPAL
and when we click on it, the selected option is set to that. But when we click on it once again, onClose()
callback for the popover containing the action buttons is also called.
https://github.com/Expensify/App/blob/5a1b35c297a6b9c6f2ee502a674b7f460bd90734/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js#L417
And this onClose()
then calls resetSelectedPaymentMethodsData
, which clears out the selected account option (currently paypal) and sets it to null.
https://github.com/Expensify/App/blob/5a1b35c297a6b9c6f2ee502a674b7f460bd90734/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js#L210-L218
What changes do you think should me made to fix this?
There is no need of clearing the selected option on closing the popover. So, we can just change the following line in Popover
:
https://github.com/Expensify/App/blob/8a856e7adc5ff3a3c2e463371d6b4a8b42644e86/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js#L417
to
onClose={() => hideDefaultDeleteMenu(false)
This will make sure that the menu is hidden but the selection is not reset because shouldClearSelectedData
will be set to false
Now, there might be doubts as to the need of the selection reset code then... Well, the function to reset the selection resetSelectedPaymentMethodData
was introduced in this PR: Expensify/App#14869
This PR was fixing the case of closing the modal if the payment option is deleted from another device. And where this code is essentially needed is in the useEffect
that handles the change in the payment methods here:
https://github.com/Expensify/App/blob/8a856e7adc5ff3a3c2e463371d6b4a8b42644e86/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js#L360-L365
Therefore, it still is fulfilling it's purpose and is being removed from where it is not needed. So, I think we can safely set shouldClearSelectedData
to false
when calling hideDefaultDeleteMenu()
to prevent the running of the function resetSelectedPaymentMethodData()
What alternative options did you explore? (Optional)
from plantonic.
Related Issues (10)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plantonic.