ekzyis 9ef0c81245
refactor: replace recursion with promise sequence in useInvoiceable (#752)
* refactor: replace recursion with promise sequence

This commit refactors `useInvoicable`. The hard-to-follow recursion was replaced by awaiting promises which resolve or reject when one step of our JIT invoice flow is done.

Therefore, `onSubmit` is now fully agnostic of JIT invoices. The handler only returns when payment + action was successful or canceled - just like when a custodial zap was successful.

* refactor more and fix bugs

* move invoice cancel logic into hook where invoice is also created
* fix missing invoice cancellation if user closes modal or goes back.
* refactor promise logic: it makes more sense to wrap the payment promise with the modal promise than the other way around.

* Fix unhandled rejection

* Fix unnecessary prop drilling

* Fix modal not closed after successful action

* Fix unnecessary async promise executor

* Use function to set state
2024-01-16 18:40:11 -06:00
..
2023-12-04 21:34:06 -06:00
2023-07-24 13:53:53 -05:00
2023-11-06 14:53:33 -06:00
2024-01-11 13:08:37 -06:00
2023-08-25 18:21:51 -05:00
2023-12-21 17:45:03 -06:00
2023-12-31 10:52:19 -06:00
2023-12-27 18:14:22 -06:00
2023-10-26 14:36:20 -05:00
2023-12-04 21:34:06 -06:00
2023-08-04 20:45:12 -05:00
2023-12-10 16:56:22 -06:00
2023-11-10 09:22:14 -06:00
2023-08-29 19:13:21 -05:00
2024-01-02 16:35:01 -06:00
2023-08-04 19:21:51 -05:00
2023-11-09 19:05:35 -06:00
2023-12-25 18:05:45 -06:00
2023-07-24 13:53:53 -05:00
2022-08-18 13:15:24 -05:00
2021-05-06 16:15:22 -05:00
2024-01-04 18:48:10 -06:00
2023-12-31 10:52:19 -06:00
2023-12-30 17:16:09 -06:00
2023-12-26 20:27:52 -06:00
2023-12-26 20:27:52 -06:00
2022-01-27 13:18:48 -06:00
2023-10-26 13:01:01 -05:00
2023-08-17 13:40:21 -05:00
2023-11-01 11:57:55 -05:00
2023-08-17 13:40:21 -05:00
2023-08-17 13:40:21 -05:00
2021-10-15 13:05:34 -05:00
2023-07-24 13:53:53 -05:00
2023-09-28 15:02:25 -05:00
2023-07-24 13:53:53 -05:00
2023-07-24 13:53:53 -05:00
2023-10-03 14:35:53 -05:00
2023-10-06 15:01:51 -05:00
2024-01-08 19:02:00 -06:00
2023-08-11 17:05:21 -05:00
2023-12-04 21:34:06 -06:00
2024-01-15 17:22:57 -06:00
2024-01-03 16:24:46 -06:00
2023-05-06 16:51:17 -05:00
2023-11-09 19:05:35 -06:00
2023-12-30 17:16:09 -06:00
2023-08-25 18:43:50 -05:00
2023-12-24 16:49:41 -06:00
2023-08-25 18:21:51 -05:00
2023-12-20 18:54:56 -06:00
2023-12-26 20:27:52 -06:00
2023-08-04 19:21:51 -05:00
2023-07-24 13:53:53 -05:00