fix(subscription): preselect pay channel before navigation

This commit is contained in:
2026-07-02 11:38:47 +08:00
parent 35c8de917d
commit cd25fa35f2
15 changed files with 121 additions and 56 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
import type { PayChannel } from "@/data/dto/payment";
export type PaymentEvent =
| { type: "PaymentInit" }
| { type: "PaymentInit"; payChannel?: PayChannel }
| { type: "PaymentPlanSelected"; planId: string }
| { type: "PaymentPayChannelChanged"; payChannel: PayChannel }
| { type: "PaymentAutoRenewChanged"; autoRenew: boolean }
+6 -1
View File
@@ -46,7 +46,12 @@ export const paymentMachine = setup({
states: {
idle: {
on: {
PaymentInit: "loadingCachedPlans",
PaymentInit: {
target: "loadingCachedPlans",
actions: assign(({ event }) =>
event.payChannel ? { payChannel: event.payChannel } : {},
),
},
},
},